-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
rustdoc: Only calculate trait_ref.self_ty()
once in get_blanket_impls
#82856
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On crates with many blanket impls, such as `stm32`, this inner closure is executed many hundreds of thousands of times. This makes it very slightly faster. Unfortunately, I don't have a good test case for showing that it's faster until rust-lang/rustc-perf#802 is merged.
r? @ollie27 (rust-highfive has picked a reviewer for you, use r? to override) |
trait_ref.self_ty()
once in get_blanket_impls
trait_ref.self_ty()
once in get_blanket_impls
The job Click to see the possible cause of the failure (guessed by this bot)
|
|
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 29, 2021
rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls Less broken version of rust-lang#82856. get_blanket_impls is a *very* hot region of rustdoc, so even small changes like this should help. Unfortunately I don't have benchmarks for this until rust-lang/rustc-perf#802 is merged.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
I-compiletime
Issue: Problems and improvements with respect to compile times.
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On crates with many blanket impls, such as
stm32
, this inner closureis executed many hundreds of thousands of times. This makes it very
slightly faster, since
self_ty
(which callstype_at
) does non-trivial work:rust/compiler/rustc_middle/src/ty/subst.rs
Lines 301 to 307 in dfe519b
Unfortunately, I don't have a good test case for showing that it's
faster until rust-lang/rustc-perf#802 is merged.