-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: Remove String
allocation in iteration in print_generic_bounds
#92283
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
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
From what I can see, it looks fine. I'd just prefer to have a second opinion (cc @camelid). In the meantime, let's check the impact on perf. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 141c542 with merge 43c0ef59a6d02c4d06e9e7cb93ecf94b313b3646... |
☀️ Try build successful - checks-actions |
Queued 43c0ef59a6d02c4d06e9e7cb93ecf94b313b3646 with parent 51e8031, future comparison URL. |
Finished benchmarking commit (43c0ef59a6d02c4d06e9e7cb93ecf94b313b3646): comparison url. Summary: This change led to moderate relevant improvements 🎉 in compiler performance.
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 led to changes in compiler perf. @bors rollup=never |
This looks good to me as well. The new version seems more "semantically correct" anyway. Thanks! @bors r=camelid,GuillaumeGomez rollup=never |
📌 Commit 141c542 has been approved by |
⌛ Testing commit 141c542 with merge dfd4b2abd8d7a4c2a0c7787abb581dc2c109735b... |
💔 Test failed - checks-actions |
@bors retry |
⌛ Testing commit 141c542 with merge c8cc55e3d85ed1006bb1cb69eb2400e8542d8bb2... |
💔 Test failed - checks-actions |
@bors retry network error |
⌛ Testing commit 141c542 with merge a38515f729cbfe5d8b8667b14b7d5ea03ab666e9... |
💔 Test failed - checks-actions |
The job Click to see the possible cause of the failure (guessed by this bot)
|
☀️ Test successful - checks-actions |
Finished benchmarking commit (8e05bb5): comparison url. Summary: This change led to moderate relevant improvements 🎉 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
(I realized only after making the commit that maybe I shouldn't refer to iteration as looping, but it's close enough)
The string representation of a
clean::GenericBound
instance (evaluated here) is deterministic for a givenself
(the instance),cx
andf
, and sincecx
andf
are constant (as far as I can tell) for a given invocation ofprint_generic_bounds
,self
is the determining factor. Therefore, using the data inself
shouldn't differ in effect from using its string representation.Given the totality of the function calls needed to evaluate the string representation as well as the actual allocation, at the very least, this shouldn't negatively affect performance.