-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Only run finalizers of accepted attributes #151382
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
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
@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.
Only run finalizers of accepted attributes
This comment has been minimized.
This comment has been minimized.
3544db9 to
6dc27bf
Compare
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (cfe6720): 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 (primary -0.1%, secondary -0.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.0%, secondary -3.7%)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: 473.058s -> 473.648s (0.12%) |
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.
Otherwise looks great. If you don't care about my nit, r=me
| let mut attr_paths: Vec<RefPathParser<'_>> = Vec::new(); | ||
| let mut early_parsed_state = EarlyParsedState::default(); | ||
|
|
||
| let mut finalizers: Vec<&FinalizeFn<S>> = Vec::with_capacity(attrs.len()); |
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.
Could be a cap of one when single is set I guess haha, or even a smallvec, idk if it makes a diff
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 think attr.len() is low for almost all realistic scenarios, so checking if single would probably be more expensive than just allocating a few extra spaces sometimes.
I am planning to see if I can win some more performance in a followup PR, will experiment with this then :)
|
@bors r=jdonszelmann |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing af6695c (parent) -> d276646 (this PR) Test differencesShow 2 test diffs2 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard d276646872981067251b0fe70131561f4a4142d8 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (d276646): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression 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 -0.4%, secondary -0.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.0%, secondary -5.0%)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: 475.177s -> 472.604s (-0.54%) |
|
Fantastic results! Do you know if this is gaining back performance that was gradually lost as attributes were ported to the new attr parsing system? Or does this represent a speed win over the old attr parsing system? Or something else? |
|
(I have no data to back this up, mostly going on my intuition) |
|
Thanks for the explanation. Sounds like the attr parser rewrite might end up being a small perf win overall on top of the large clarity/correctness win. Nice! |
Locally this had insanely good perf, but lets see what reality thinks about this
r? @jdonszelmann
Attribute parsing consists of two stages:
This two-stage process exist so multiple attributes can get merged into one parser representation. For example if you have two repr attributes
#[repr(C)]#[repr(packed)]it will only produce one parsedReprattribue.The dumb thing we did was we would "finalize" all parsers, even the ones that never accepted an attribute. This PR only calls finalize on the parsers that accepted at least one attribute.