-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[Experiment] Box diagnostic_metadata
field
#98120
Conversation
@bors try @rust-timer queue |
Insufficient permissions to issue commands to rust-timer. |
@TaKO8Ki: 🔑 Insufficient privileges: not in try users |
I don't have permission to run perf. |
This is exactly what I had thought the issue was saying, yet it surely only adds the cost of additional heap allocs? I'm sure I must be missing something, as I can't see how there could be any benefit from it? |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 5ece481 with merge e5e645fd772153e58de155a806285c5cef5d3428... |
☀️ Try build successful - checks-actions |
Queued e5e645fd772153e58de155a806285c5cef5d3428 with parent 2d1e075, future comparison URL. |
Finished benchmarking commit (e5e645fd772153e58de155a806285c5cef5d3428): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesThis benchmark run did not return any relevant results for this metric. 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 |
@TaKO8Ki Very nice! |
Really surprised by this... can someone explain it? |
In general, boxing an attribute moves it to the heap, so you pay the cost for allocating (both in executed instructions and extra memory usage). But on the other hand, it can reduce the size of the structure that contains the attribute (e.g. if a field has 64 bytes and you box it, the size gets reduced to 8 bytes), which in turn can improve performance (less data loaded from memory, better cache utilization etc.). That being said, I'm not really seeing any great improvements in the perf. results here. Instruction counts and cycles are a wash and Max RSS was improved only in three cases with quite low significance factor (on average it's just -0.24% improvement). So I'm not sure if this is worth it. |
Indeed, but this particular structure is quite large already so the reduction in its stack size shouldn't have a material impact. Moreover, the identified change is to total memory consumption: yet the heap allocs are made on object creation and maintained until object destruction so total memory should in fact have increased (by the size of the pointer). Anyway, thank you for your thoughts! I'll leave it at that; I just found the idea of this experiment, and it's outcome, rather surprising/unintuitive. |
Is it? The only things that stand out to me as "potentially big" are rust/compiler/rustc_resolve/src/late.rs Lines 521 to 552 in 5ece481
That being said, given how resolution behaves, without needing to clone or be moved too much, I guess it's not surprising this didn't have significant perf impacts, beyond the margins. That being said, I can go either on whether we should merge this or not, particularly given the patch size :) |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (96c2df8): 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 |
closes #97954
r? @estebank