-
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
Use ThinVec
for PredicateObligation storage
#131422
Use ThinVec
for PredicateObligation storage
#131422
Conversation
This comment has been minimized.
This comment has been minimized.
3912168
to
d72444b
Compare
This comment has been minimized.
This comment has been minimized.
d72444b
to
8df8a1b
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…ions, r=<try> WIP: Use `SmallVec` for `PredicateObligation` storage I noticed while profiling clippy on a project that a large amount of time is being spent allocating `Vec`s for `PredicateObligation`, and the `Vec`s are often quite small. This is an attempt to optimise this by using SmallVec to avoid heap allocations for these common small Vecs. First, I am making sure a single type alias is being used whenever referring to a Vec of PredicateObligation, then I can swap this type alias to `SmallVec` and test out different amounts of inline storage until I find a sweet spot. This is WIP, now at the stage of checking if this is a performance win and tuning the inline capacity. r? `@ghost`
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (56bfc05): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -2.2%, secondary 0.7%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary 3.3%, secondary 4.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 776.8s -> 781.301s (0.58%) |
8df8a1b
to
fda8da9
Compare
@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.
1 similar comment
This comment has been minimized.
This comment has been minimized.
…ions, r=<try> WIP: Use `SmallVec` for `PredicateObligation` storage I noticed while profiling clippy on a project that a large amount of time is being spent allocating `Vec`s for `PredicateObligation`, and the `Vec`s are often quite small. This is an attempt to optimise this by using SmallVec to avoid heap allocations for these common small Vecs. First, I am making sure a single type alias is being used whenever referring to a Vec of PredicateObligation, then I can swap this type alias to `SmallVec` and test out different amounts of inline storage until I find a sweet spot. This is WIP, now at the stage of checking if this is a performance win and tuning the inline capacity. - Heavy (0-11%) performance drop with `4` inline capacity. r? `@ghost`
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
r? compiler |
@bors r+ rollup=never |
…ions, r=compiler-errors Use `ThinVec` for PredicateObligation storage ~~I noticed while profiling clippy on a project that a large amount of time is being spent allocating `Vec`s for `PredicateObligation`, and the `Vec`s are often quite small. This is an attempt to optimise this by using SmallVec to avoid heap allocations for these common small Vecs.~~ This PR turns all the `Vec<PredicateObligation>` into a single type alias while avoiding referring to `Vec` around it, then swaps the type over to `ThinVec<PredicateObligation>` and fixes the fallout. This also contains an implementation of `ThinVec::extract_if`, copied from `Vec::extract_if` and currently being upstreamed to Gankra/thin-vec#66. This leads to a small (0.2-0.7%) performance gain in the latest perf run.
💔 Test failed - checks-actions |
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot)
|
@bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (9618da7): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -1.0%, secondary -0.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 1.7%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 782.214s -> 781.789s (-0.05%) |
Nice results! :) Good find. |
Visiting for perf triage
@rustbot label: +perf-regression-triaged |
I noticed while profiling clippy on a project that a large amount of time is being spent allocatingVec
s forPredicateObligation
, and theVec
s are often quite small. This is an attempt to optimise this by using SmallVec to avoid heap allocations for these common small Vecs.This PR turns all the
Vec<PredicateObligation>
into a single type alias while avoiding referring toVec
around it, then swaps the type over toThinVec<PredicateObligation>
and fixes the fallout. This also contains an implementation ofThinVec::extract_if
, copied fromVec::extract_if
and currently being upstreamed to Gankra/thin-vec#66.This leads to a small (0.2-0.7%) performance gain in the latest perf run.