Skip to content

Make bridge::Buffer generic again. #97539

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

Closed

Conversation

nnethercote
Copy link
Contributor

It was made non-generic in #97004, but that (surprisingly) caused a mild
performance regression.

r? @eddyb

It was made non-generic in rust-lang#97004, but that (surprisingly) caused a mild
performance regression.
@rust-highfive

This comment was marked as off-topic.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 30, 2022
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 30, 2022
@bors
Copy link
Collaborator

bors commented May 30, 2022

⌛ Trying commit b41ece9 with merge 2032e7bcf336d8021dd5ab28f20766209c37ea49...

@nnethercote nnethercote mentioned this pull request May 30, 2022
@alex
Copy link
Member

alex commented May 30, 2022

I'd have guessed the being non-generic was a performance regression because of the impact on cross-crate inlining, but all the changes here are in a single create 🤷

@bors
Copy link
Collaborator

bors commented May 30, 2022

☀️ Try build successful - checks-actions
Build commit: 2032e7bcf336d8021dd5ab28f20766209c37ea49 (2032e7bcf336d8021dd5ab28f20766209c37ea49)

@rust-timer
Copy link
Collaborator

Queued 2032e7bcf336d8021dd5ab28f20766209c37ea49 with parent 28b8919, future comparison URL.

@mystor
Copy link
Contributor

mystor commented May 30, 2022

I'd have guessed the being non-generic was a performance regression because of the impact on cross-crate inlining, but all the changes here are in a single create 🤷

The type is used in generic code by the proc_macro server when specializing it for use by proc_macro_server.rs when configuring the server types, which is probably where the regression came from. Marking the methods as #[inline] probably will have a similar impact to making it generic again.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2032e7bcf336d8021dd5ab28f20766209c37ea49): comparison url.

Instruction count

  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: 🎉 relevant improvements found
mean1 max count2
Regressions 😿
(primary)
2.2% 2.2% 1
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-0.8% -1.4% 7
All 😿🎉 (primary) 2.2% 2.2% 1

Max RSS (memory usage)

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
2.4% 2.4% 1
Regressions 😿
(secondary)
3.1% 4.1% 2
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 2.4% 2.4% 1

Cycles

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: no relevant changes found
mean1 max count2
Regressions 😿
(primary)
3.3% 3.3% 1
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 3.3% 3.3% 1

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 @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels May 30, 2022
@eddyb
Copy link
Member

eddyb commented May 31, 2022

r=me if this is acceptable, but @mystor's #[inline] suggestion is what I came here to also suggest, it might be simpler?

@nnethercote
Copy link
Contributor Author

Which methods would need inlining?

Comment on lines +8 to +9
// `T` is always `u8` in practice. Attempts to remove `T` caused mild
// performance regressions, surprisingly enough.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, every fn in this module might need #[inline] (all 17 of them), so can you just edit the comment to say that without generics, #[inline] would be needed everywhere to avoid performance regressions and r=me?

@nnethercote
Copy link
Contributor Author

I tried the inlining approach and it gave slightly better performance, so I have opened #97604.

@nnethercote nnethercote deleted the make-Buffer-generic-again branch May 31, 2022 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants