-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Introduce Symbol::with_interner
.
#144287
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
base: master
Are you sure you want to change the base?
Introduce Symbol::with_interner
.
#144287
Conversation
It lets you get the contents of multiple symbols with a single TLS lookup and interner lock, instead of one per symbol.
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Introduce `Symbol::with_interner`. It lets you get the contents of multiple symbols with a single TLS lookup and interner lock, instead of one per symbol. r? `@ghost`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (1a8eaa8): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -2.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 465.536s -> 463.932s (-0.34%) |
s.push_str(sym.as_str()); | ||
} | ||
s | ||
Symbol::with_interner(|interner| { |
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.
Nit: the interner is locked for slightly longer than necessary.
let whitespace = | ||
line.chars().take_while(|c| *c == ' ' || *c == '\t').count(); | ||
whitespace | ||
+ (if fragment.kind == DocFragmentKind::SugaredDoc { |
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.
Nit: the formatting is bad, could you move the if expression to a local variable or something like that?
i2: &clean::Item, | ||
interner: &InternerInner, | ||
tcx: TyCtxt<'_>, | ||
) -> Ordering { |
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.
Again, the interner is locked for very long time.
I'm actually surprised that something like i1.stability(tcx)
inside doesn't try to lock the interner again.
This does bring a few small speedups to rustdoc, but I'm not sure it justifies exposing all this private machinery. |
It lets you get the contents of multiple symbols with a single TLS lookup and interner lock, instead of one per symbol.
r? @petrochenkov