-
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
ctfe: limit hashing of big const allocations when interning #98097
Conversation
This should only show up in our benchmarks for the heaviest users of const allocs, that is @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 365c2d07e7244a69e74e5e383a1964da68d53b1d with merge ad147c4725df34afea504da0eb637357cb4ff376... |
☀️ Try build successful - checks-actions |
Queued ad147c4725df34afea504da0eb637357cb4ff376 with parent edab34a, future comparison URL. |
Finished benchmarking commit (ad147c4725df34afea504da0eb637357cb4ff376): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 Footnotes |
Cycles and wall-times are interesting here, and show no regression. Unexpectedly, the (I also wonder if there's some weird cg variance on my machine, running this benchmark with the same toolchain, in debug or incremental many times: I had a big +/- 50M instructions change 😱 a few times. I went back to valgrind 0.19 instead of master just in case, but it's worrying) I'll try only hashing the buffer's length and head, just to see how it looks on the perfbot. |
Here as well, slightly better on @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit f0fd57ab1611c8143ab286050f04e15de7f0da13 with merge 1757554a03f8b24918b67fa4ecd85da2e6ae8a73... |
☀️ Try build successful - checks-actions |
Queued 1757554a03f8b24918b67fa4ecd85da2e6ae8a73 with parent a4cec97, future comparison URL. |
Finished benchmarking commit (1757554a03f8b24918b67fa4ecd85da2e6ae8a73): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 Footnotes |
Alright. Do you think this could be interesting @oli-obk ? |
Let's do one final test with the previous scheme of hashing both the buffers' head and tail, to see whether the @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit e56ac3aa6ea6f1c4fd1a850640ac864f90924048 with merge 50fec4d723e9ef5d66ef11a543c79e3b678e0087... |
☀️ Try build successful - checks-actions |
So maybe it was indeed noisy. I've reverted everything back to the initial version of this PR then. |
r=me with constants shared |
Big const allocations hash a large amount of data for interning: the whole bytes buffer, and the 1/8th sized initmask, with FxHash. This hash function is made for shorter keys. This only hashes the length, and head and tail of these buffers, to limit possible collisions while avoiding most of the hashing work.
Once more, with feeling. Last sanity check. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit b1f31f8 with merge cc1038029baebe7680a99427a25885339bbfa7aa... |
☀️ Try build successful - checks-actions |
Queued cc1038029baebe7680a99427a25885339bbfa7aa with parent 6ec3993, future comparison URL. |
Finished benchmarking commit (cc1038029baebe7680a99427a25885339bbfa7aa): comparison url. Instruction count
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 Footnotes |
CI is green. I've adjusted the constants and comments. @bors r=oli-obk |
📌 Commit 61dc080 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (43c47db): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Const allocations are only hashed for interning. However, they can be large, making the hashing expensive especially since it uses
FxHash
: it's better suited to short keys, not potentially big buffers like the actual bytes of allocation and the associated 1/8th sizedInitMask
.We can partially hash these fields when they're large, hashing the length, and head and tail of these buffers, to
limit possible collisions while avoiding most of the hashing work.
r? @ghost