-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Support encoding spans with relative offsets #119302
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Encode spans with relative offsets The relative offset is always smaller than the absolute offset, and with the LEB128 encoding, this ends up cutting the overall metadata size considerably (~1.5 megabytes on libcore).
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
9aec3df
to
4b34a61
Compare
Pushed optionally-relative encoding -- it's strictly better than before now from a bytes-on-disk perspective, we can run another try + perf run but my sense is that it's probably not necessary if this one comes back clean. |
Finished benchmarking commit (a32f9c5): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 670.163s -> 669.991s (-0.03%) |
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.
r=me with nits
@rustbot author
Entry::Occupied(o) => { | ||
// If an offset is smaller than the absolute position, we encode with the offset. | ||
// This saves space since smaller numbers encode in less bits. | ||
let offset = s.opaque.position() - *o.get(); |
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.
can this ever underflow? (if it can the code probably needs to account for that, if it can't, it would be nice to have a comment)
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.
No, it shouldn't be possible. We write ~all metadata bytes strictly increasing positions in the buffer, so the current position must be larger than the position we saved into the HashMap.
I'll add a comment.
Entry::Occupied(o) => { | ||
// If an offset is smaller than the absolute position, we encode with the offset. | ||
// This saves space since smaller numbers encode in less bits. | ||
let offset = s.opaque.position() - *o.get(); |
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.
since *o.get()
is used multiple times, it would be nicer to have a variable for it like let &addr = o.get();
.
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.
Can do.
The relative offset is often smaller than the absolute offset, and with the LEB128 encoding, this ends up cutting the overall metadata size considerably (~1.5 megabytes on libcore). We can support both relative and absolute encodings essentially for free since we already take a full byte to differentiate between direct and indirect encodings (so an extra variant is quite cheap).
4b34a61
to
9c5293c
Compare
@bors r=WaffleLapkin |
…ffleLapkin Support encoding spans with relative offsets The relative offset is often smaller than the absolute offset, and with the LEB128 encoding, this ends up cutting the overall metadata size considerably (~1.5 megabytes on libcore). We can support both relative and absolute encodings essentially for free since we already take a full byte to differentiate between direct and indirect encodings (so an extra variant is quite cheap).
💔 Test failed - checks-actions |
@bors retry network timeout issue |
There's a crates.io outage, currently in recovery, so we'll see if it works this time. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (15755f3): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 671.868s -> 670.827s (-0.15%) |
The relative offset is often smaller than the absolute offset, and with
the LEB128 encoding, this ends up cutting the overall metadata size
considerably (~1.5 megabytes on libcore). We can support both relative
and absolute encodings essentially for free since we already take a full
byte to differentiate between direct and indirect encodings (so an extra
variant is quite cheap).