-
Notifications
You must be signed in to change notification settings - Fork 565
Make Sorbet faster to start in debug build #8050
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
Conversation
These are all hot for the sake of reading the initial GlobalState, and are all ~trivial integer or boolean operations that should never take a long time (vs something like an `absl::c_count` that maps a function over a vector to compute a property).
In `--config=dbg` we don't necessarily get optimizations that would remove this check. I want to make sure it gets removed and that's easy with `constexpr`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a test failure
|
||
sanityCheckTableSizes(); | ||
sanityCheckNames(); | ||
|
||
{ | ||
Timer timeit(tracer(), "GlobalState::sanityCheck (symbols)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to split this off into sanityCheckSymbols
? Do we always want to also do sanityCheckTableSizes
and sanityCheckNames
when this is done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure what you're asking.
There were some places where I only wanted to sanity check the table sizes, or sanity check the names, so I factored out helpers for these.
There were no places where I only wanted to sanity check the symbols, so I did not factor them out of the top-level sanity check function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that answers exactly what I was asking, thanks.
This reverts commit 5101acf. Somehow this caused CI to become flaky?
* Add timers to GlobalState::sanityCheck * ENFORCE -> ENFORCE_NO_TIMER in a lot of hot places These are all hot for the sake of reading the initial GlobalState, and are all ~trivial integer or boolean operations that should never take a long time (vs something like an `absl::c_count` that maps a function over a vector to compute a property). * Use `constexpr` for `fuzz_mode` and `debug_mode` In `--config=dbg` we don't necessarily get optimizations that would remove this check. I want to make sure it gets removed and that's easy with `constexpr`. fastmod 'if \(fuzz_mode\)' 'if constexpr (fuzz_mode)' fastmod 'if \((!?)debug_mode\)' 'if constexpr (${1}debug_mode)' tools/scripts/format_cxx.sh * Remove some counters that are not that useful * Factor out sanityCheckTableSizes function * Factor out sanityCheckNames function
Motivation
It had been starting to annoy me how long it would take to start Sorbet in debug
mode, so I went and profiled it and culled the biggest offenders.
Test plan
Existing tests