-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
resolve: Replace Macros20NormalizedIdent with IdentKey
#151550
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: main
Are you sure you want to change the base?
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
resolve: Replace `Macros20NormalizedIdent` with `IdentKey`
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0b62e28): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @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 (primary -1.7%, secondary -1.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.7%, secondary 5.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 470.684s -> 470.503s (-0.04%) |
181aae7 to
2f655fb
Compare
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
|
r? @nnethercote |
|
(I also want to try passing the |
This is a continuation of #150741 and #150982 based on the ideas from #151491 (comment).
Before this PR
Macros20NormalizedIdentwas used as a key in various "identifier -> its resolution" maps inrustc_resolve.Macros20NormalizedIdentis a newtype aroundIdentin whichSyntaxContext(packed insideSpan) is guaranteed to be normalized usingnormalize_to_macros_2_0.This type is also used in a number of functions looking up identifiers in those maps.
Macros20NormalizedIdentstill contains span locations, which are useless and ignored during hash map lookups and comparisons due toIdent's specialPartialEqandHashimpls.This PR replaces
Macros20NormalizedIdentwith a new type calledIdentKey, which contains only a symbol and a normalized unpacked syntax context. (E.g.IdentKey==Macros20NormalizedIdentminus span locations.)So we avoid keeping additional data and doing some syntax context packing/unpacking.
Along with
IdentKeyyou can often seeorig_ident_span: Spanbeing passed around.This is an unnormalized span of the original
Identfrom whichIdentKeywas obtained.It is not used in map keys, but it is used in a number of other scenarios:
allow_unstablechecksThis is because
normalize_to_macros_2_0normalization is lossy and the normalized spans / syntax contexts no longer contain parts of macro backtraces, while the original span contains everything.