-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Specialize ToString for Symbol #103656
Specialize ToString for Symbol #103656
Conversation
r? @estebank (rustbot has picked a reviewer for you, use r? to override) |
A simple local bench of |
compiler/rustc_span/src/symbol.rs
Outdated
// takes advantage of `str::to_string` specialization | ||
impl ToString for Symbol { | ||
fn to_string(&self) -> String { | ||
return self.as_str().to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return self.as_str().to_string(); | |
self.as_str().to_string() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to take a mental break after switching from Python.
@bors try @rust-timer queue (though likely to show no results, since I guess heavy usage of |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 382628149d3a76ade854d5cf3aaa087aeb675e79 with merge 6cdae94b58bcfb1ada8d169f8a6a36a73e68e77b... |
☀️ Try build successful - checks-actions |
Queued 6cdae94b58bcfb1ada8d169f8a6a36a73e68e77b with parent 126dbdc, future comparison URL. |
Finished benchmarking commit (6cdae94b58bcfb1ada8d169f8a6a36a73e68e77b): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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 Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. |
Finished benchmarking commit (6cdae94b58bcfb1ada8d169f8a6a36a73e68e77b): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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 Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. |
Hm, maybe this PR is not worth the added impl? Unless @camsteffen has something in mind that benefits from this speed boost. |
I could go either way. On one hand Symbol is very widely used and this is a low-cost common-sense optimization. On the other hand this probably won't make anyone's life better. |
I guess it doesn't hurt anything. r? @compiler-errors @bors r+ |
📌 Commit 382628149d3a76ade854d5cf3aaa087aeb675e79 has been approved by It is now in the queue for this repository. |
3826281
to
298253a
Compare
@bors r=compiler-errors Removed the needless |
Thanks, forgot that hadn't gotten applied. |
@bors rollup |
…piler-errors Specialize ToString for Symbol
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#102961 (Make `CStr::from_ptr` `const`.) - rust-lang#103342 (Add test for issue 98634) - rust-lang#103383 (Note scope of TAIT more accurately) - rust-lang#103656 (Specialize ToString for Symbol) - rust-lang#103663 (rustdoc: remove redundant CSS/DOM `div.search-container`) - rust-lang#103664 (rustdoc-json-types: Improve ItemSummary::path docs) - rust-lang#103704 (Add a test for TAIT used with impl/dyn Trait inside RPIT) Failed merges: - rust-lang#103618 (Rename some `OwnerId` fields.) r? `@ghost` `@rustbot` modify labels: rollup
No description provided.