Merged
Conversation
As it turns out, the Rust compiler uses variable length LEB128 encoded
integers internally. It so happens that they spent a fair amount of
effort micro-optimizing the decoding functionality [0] [1], as it's in
the hot path.
With this change we replace our decoding routines with these optimized
ones. To make that happen more easily (and to gain some base line speed
up), also remove the "shift" return from the respective methods. As a
result of these changes, we see a respectable speed up:
Before:
test util::tests::bench_u64_leb128_reading ... bench: 128 ns/iter (+/- 10)
After:
test util::tests::bench_u64_leb128_reading ... bench: 103 ns/iter (+/- 5)
Gsym decoding, which uses these routines, improved as follows:
main/symbolize_gsym_multi_no_setup
time: [146.26 µs 146.69 µs 147.18 µs]
change: [−7.2075% −5.7106% −4.4870%] (p = 0.00 < 0.02)
Performance has improved.
[0] rust-lang/rust#69050
[1] rust-lang/rust#69157
Signed-off-by: Daniel Müller <deso@posteo.net>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #719 +/- ##
==========================================
+ Coverage 94.62% 94.65% +0.03%
==========================================
Files 49 49
Lines 9466 9486 +20
==========================================
+ Hits 8957 8979 +22
+ Misses 509 507 -2 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As it turns out, the Rust compiler uses variable length LEB128 encoded integers internally. It so happens that they spent a fair amount of effort micro-optimizing the decoding functionality [0] [1], as it's in the hot path.
With this change we replace our decoding routines with these optimized ones. To make that happen more easily (and to gain some base line speed up), also remove the "shift" return from the respective methods. As a result of these changes, we see a repsectable speed up:
Before:
After:
Gsym decoding, which uses these routines, improved as follows:
[0] rust-lang/rust#69050
[1] rust-lang/rust#69157