-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Introduce ByteSymbol
#141875
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
base: master
Are you sure you want to change the base?
Introduce ByteSymbol
#141875
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Introduce `ByteSymbol` r? `@ghost`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (f661a16): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -1.9%, secondary -1.7%)This 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.
CyclesResults (primary -2.4%, secondary 0.3%)This 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 sizeResults (primary -1.1%)This 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: 775.84s -> 774.376s (-0.19%) |
The motivation here: introduce It works, and the max-rss results (and page faults) are down for the literal-heavy benchmarks: |
Upd: but maybe most of the (non-backend) improvements we already done in #103812. |
This is a real issue because people want to include relatively large binary blobs into their programs, but I'm not sure we have a relevant benchmark in the perf suite. It makes sense to benchmark this change on something specifically binary-blob-oriented. |
I actually wanted to share the interner between string symbols and byte symbols. #65818 (comment) suggested making Not sure if the same sharing can be done for metadata encoding/decoding tables. |
I think this generally makes sense, the byte array interner is not large and is mostly a copypaste of the string interner, so not much new complexity. |
Reminder, once the PR becomes ready for a review, use |
I benchmarked this program: pub const BYTES: &[u8] = include_bytes!("/bin/containerd");
fn main() {
println!("len = {}", BYTES.len());
} On my Linux box hyperfine results, before and after:
I.e. this PR makes things a little slower. Probably because of the cost of hashing the binary blob to convert it into a |
Seems reasonable, big binary blobs are unlikely to be identical, so not much sense to try deduplicating them. |
Surprising it's only a little slower: Cachegrind says my example program takes 39 million instrs to compile normally and 67 million instructions with this PR's changes. The differences being all in hashing and some Edit: if I put the benchmark into rustc-perf and measure it, for a |
r? @ghost