Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codegen+bootstrap+runtime: Use switch-statements in enum's debug_description + Remove Variant::visit #1038

Merged
merged 2 commits into from
Aug 6, 2022

Conversation

Hendiadyoin1
Copy link
Contributor

codegen: Use a switch statement in enum's debug_description

This is the last occurrence of Variant::visit, which may be putting some
strain on compilers template engines

runtime+bootstrap: Update stage0 and remove Variant::visit

This is as of the last commit unused and we have a better way of
implementing this through our compiler without relying on the
c++-compiler's template engine.


I did not update the stage0 README. because the commit hashes may change during merging

@ilyapopov
Copy link
Contributor

Performance measurement:

hyperfine "cd jakt/build/ && clang++ -std=c++20 -I ../runtime/ -Wno-parentheses-equality -Wno-trigraphs -Wno-user-defined-literals jakt.cpp" "cd jakt-pr1038/build/ && clang++ -std=c++20 -I ../runtime/ -Wno-parentheses-equality -Wno-trigraphs -Wno-user-defined-literals jakt.cpp"
Benchmark 1: cd jakt/build/ && clang++ -std=c++20 -I ../runtime/ -Wno-parentheses-equality -Wno-trigraphs -Wno-user-defined-literals jakt.cpp
  Time (mean ± σ):     14.773 s ±  0.077 s    [User: 14.204 s, System: 0.555 s]
  Range (min … max):   14.683 s … 14.953 s    10 runs
 
Benchmark 2: cd jakt-pr1038/build/ && clang++ -std=c++20 -I ../runtime/ -Wno-parentheses-equality -Wno-trigraphs -Wno-user-defined-literals jakt.cpp
  Time (mean ± σ):     13.734 s ±  0.068 s    [User: 13.232 s, System: 0.486 s]
  Range (min … max):   13.615 s … 13.860 s    10 runs
 
Summary
  'cd jakt-pr1038/build/ && clang++ -std=c++20 -I ../runtime/ -Wno-parentheses-equality -Wno-trigraphs -Wno-user-defined-literals jakt.cpp' ran
    1.08 ± 0.01 times faster than 'cd jakt/build/ && clang++ -std=c++20 -I ../runtime/ -Wno-parentheses-equality -Wno-trigraphs -Wno-user-defined-literals jakt.cpp'

So, this PR cuts about 1s (8%) from build time!

Copy link
Member

@alimpfard alimpfard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just one nitpick.

selfhost/codegen.jakt Outdated Show resolved Hide resolved
This is the last occurrence of Variant::visit, which may be putting some
strain on compilers template engines
This is as of the last commit unused and we have a better way of
implementing this through our compiler without relying on the
c++-compiler's template engine.
@Hendiadyoin1 Hendiadyoin1 force-pushed the nono-variant branch 2 times, most recently from 8c32698 to e931755 Compare August 6, 2022 18:26
@awesomekling awesomekling merged commit f655061 into SerenityOS:main Aug 6, 2022
@Hendiadyoin1 Hendiadyoin1 deleted the nono-variant branch August 6, 2022 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants