-
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
Change SymbolName::name
to a &str
.
#74214
Conversation
This gives some very small perf wins. At least they're mostly on the real-world benchmarks. Here is a subset of results:
|
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 61e2a3949b118fd04592e73c8ca4ef4b805076a2 with merge 28b4962ee286e2682945dd2a9b3dec058d518ec7... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 28b4962ee286e2682945dd2a9b3dec058d518ec7 with parent e59b08e, future comparison URL. |
Finished benchmarking try commit (28b4962ee286e2682945dd2a9b3dec058d518ec7): comparison url. |
I only measured @bors rollup=never |
impl<'tcx> Value<'tcx> for ty::SymbolName<'_> { | ||
fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Self { | ||
// SAFETY: This is never called when `Self` is not `SymbolName<'tcx>`. | ||
// FIXME: Represent the above fact in the trait system somehow. |
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.
Why can't you write ty::SymbolName<'tcx>
? That's why Value
has a 'tcx
parameter.
Oh this is a specialization issue. IMO it should be noted as such rather then left as a vague FIXME
(cc @matthewjasper).
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.
What exactly would you like me to write in the comment?
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 hope @matthewjasper can come up with a better comment. Otherwise it's probably fine as-is.
Although I kind of doubt this from_cycle_error
implementation is needed at all.
61e2a39
to
b55f975
Compare
☔ The latest upstream changes (presumably #74175) made this pull request unmergeable. Please resolve the merge conflicts. |
This eliminates a bunch of `Symbol::intern()` and `Symbol::as_str()` calls, which is good, because they require locking the interner. Note that the unsafety in `from_cycle_error()` is identical to the unsafety on other adjacent impls.
b55f975
to
a1b8540
Compare
@bors r+ |
📌 Commit a1b8540 has been approved by |
☀️ Test successful - checks-actions, checks-azure |
This was a perf win upon landing, as expected. |
This eliminates a bunch of
Symbol::intern()
andSymbol::as_str()
calls, which is good, because they require locking the interner.
Note that the unsafety in
from_cycle_error()
is identical to theunsafety on other adjacent impls.
r? @eddyb