Tweak VecCache
to improve performance by Zoxc · Pull Request #138405 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
This file contains hidden or 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
[ Show hidden characters]({{ revealButtonHref }})
This has some tweaks to VecCache
to improve performance.
- It saves a
compare_exchange
incomplete
using the newput_unique
function. - It removes bound checks on entries. These are instead checked in the
slot_index_exhaustive
test. initialize_bucket
is outlined and tuned for that.
r? @Noratrieb
rustbot has assigned @Noratrieb.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r?
to explicitly pick a reviewer
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
bors added a commit to rust-lang-ci/rust that referenced this pull request
Tweak VecCache
to improve performance
This has some tweaks to VecCache
to improve performance.
- It saves a
compare_exchange
incomplete
using the newput_unique
function. - It removes bound checks on entries. These are instead checked in the
slot_index_exhaustive
test. initialize_bucket
is outlined and tuned for that.
cc @Mark-Simulacrum
☀️ Try build successful - checks-actions
Build commit: 0b0612c (0b0612c92faadc7268901ca7f18b6859d25f4eba
)
This comment has been minimized.
} |
---|
#[cold] |
fn initialize_bucket(&self, bucket: &AtomicPtr<Slot>) -> *mut Slot { |
#[inline(never)] |
fn initialize_bucket(bucket: &AtomicPtr<Slot>, bucket_idx: usize) -> *mut Slot { |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It avoids Self
needing it exist when not inlined, as the needed information can be passed in registers instead.
Finished benchmarking commit (0b0612c): comparison URL.
Overall result: ❌✅ regressions and improvements - please read the text below
Benchmarking 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 @rustbot label: +perf-regression-triaged
along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.
@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression
Instruction count
This 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.
mean | range | count | |
---|---|---|---|
Regressions ❌ (primary) | - | - | 0 |
Regressions ❌ (secondary) | 0.9% | [0.2%, 1.8%] | 15 |
Improvements ✅ (primary) | -0.4% | [-0.9%, -0.2%] | 140 |
Improvements ✅ (secondary) | -0.6% | [-1.2%, -0.2%] | 42 |
All ❌✅ (primary) | -0.4% | [-0.9%, -0.2%] | 140 |
Max RSS (memory usage)
Results (primary -2.0%)
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.
mean | range | count | |
---|---|---|---|
Regressions ❌ (primary) | - | - | 0 |
Regressions ❌ (secondary) | - | - | 0 |
Improvements ✅ (primary) | -2.0% | [-2.8%, -1.2%] | 2 |
Improvements ✅ (secondary) | - | - | 0 |
All ❌✅ (primary) | -2.0% | [-2.8%, -1.2%] | 2 |
Cycles
Results (primary 4.1%, secondary -3.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.
mean | range | count | |
---|---|---|---|
Regressions ❌ (primary) | 6.8% | [1.6%, 13.7%] | 13 |
Regressions ❌ (secondary) | - | - | 0 |
Improvements ✅ (primary) | -1.7% | [-2.1%, -1.4%] | 6 |
Improvements ✅ (secondary) | -3.1% | [-3.5%, -2.5%] | 3 |
All ❌✅ (primary) | 4.1% | [-2.1%, 13.7%] | 19 |
Binary size
This benchmark run did not return any relevant results for this metric.
Bootstrap: 779.667s -> 779.823s (0.02%)
Artifact size: 365.24 MiB -> 365.04 MiB (-0.06%)
Local results:
Benchmark | Before | After | Before | After | Before | After | |||
---|---|---|---|---|---|---|---|---|---|
Time | Time | % | Physical Memory | Physical Memory | % | Committed Memory | Committed Memory | % | |
🟣 clap:check | 1.4028s | 1.3962s | -0.47% | 147.60 MiB | 147.57 MiB | -0.02% | 192.07 MiB | 192.06 MiB | -0.01% |
🟣 hyper:check | 0.2335s | 0.2321s | -0.58% | 80.01 MiB | 79.95 MiB | -0.07% | 121.83 MiB | 121.83 MiB | -0.01% |
🟣 regex:check | 0.7944s | 0.7918s | -0.33% | 108.43 MiB | 108.50 MiB | 0.07% | 146.66 MiB | 146.80 MiB | 0.09% |
🟣 syn:check | 1.3258s | 1.3183s | -0.57% | 141.93 MiB | 141.92 MiB | -0.01% | 180.31 MiB | 180.36 MiB | 0.03% |
Total | 3.7565s | 3.7385s | -0.48% | 477.97 MiB | 477.95 MiB | -0.00% | 640.87 MiB | 641.04 MiB | 0.03% |
Summary | 1.0000s | 0.9951s | -0.49% | 1 byte | 1.00 bytes | -0.01% | 1 byte | 1.00 bytes | 0.03% |
Looks like something might be up with html5ever
.
I can't reproduce the html5ever
regression locally:
Benchmark | Before | After | Before | After | Before | After | |||
---|---|---|---|---|---|---|---|---|---|
Time | Time | % | Physical Memory | Physical Memory | % | Committed Memory | Committed Memory | % | |
🟣 html5ever:check | 0.6299s | 0.6256s | -0.67% | 104.10 MiB | 103.98 MiB | -0.11% | 147.54 MiB | 147.58 MiB | 0.02% |
Total | 0.6299s | 0.6256s | -0.67% | 104.10 MiB | 103.98 MiB | -0.11% | 147.54 MiB | 147.58 MiB | 0.02% |
Summary | 1.0000s | 0.9933s | -0.67% | 1 byte | 1.00 bytes | -0.11% | 1 byte | 1.00 bytes | 0.02% |
Cycles are noisy, although this was high above the threshold. Let's try again, just in case it was a fluke.
@bors try @rust-timer queue
This comment has been minimized.
bors added a commit to rust-lang-ci/rust that referenced this pull request
Tweak VecCache
to improve performance
This has some tweaks to VecCache
to improve performance.
- It saves a
compare_exchange
incomplete
using the newput_unique
function. - It removes bound checks on entries. These are instead checked in the
slot_index_exhaustive
test. initialize_bucket
is outlined and tuned for that.
cc @Mark-Simulacrum
☀️ Try build successful - checks-actions
Build commit: d06bb14 (d06bb14bb9c4c2e005971e2f02d13bb79af6845e
)
This comment has been minimized.
Finished benchmarking commit (d06bb14): comparison URL.
Overall result: ❌✅ regressions and improvements - please read the text below
Benchmarking 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 @rustbot label: +perf-regression-triaged
along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.
@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression
Instruction count
This 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.
mean | range | count | |
---|---|---|---|
Regressions ❌ (primary) | - | - | 0 |
Regressions ❌ (secondary) | 1.3% | [0.6%, 1.8%] | 10 |
Improvements ✅ (primary) | -0.4% | [-0.9%, -0.2%] | 143 |
Improvements ✅ (secondary) | -0.6% | [-1.3%, -0.2%] | 43 |
All ❌✅ (primary) | -0.4% | [-0.9%, -0.2%] | 143 |
Max RSS (memory usage)
This benchmark run did not return any relevant results for this metric.
Cycles
Results (primary -1.5%, secondary -2.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.
mean | range | count | |
---|---|---|---|
Regressions ❌ (primary) | - | - | 0 |
Regressions ❌ (secondary) | - | - | 0 |
Improvements ✅ (primary) | -1.5% | [-1.5%, -1.5%] | 1 |
Improvements ✅ (secondary) | -2.1% | [-2.1%, -2.1%] | 1 |
All ❌✅ (primary) | -1.5% | [-1.5%, -1.5%] | 1 |
Binary size
This benchmark run did not return any relevant results for this metric.
Bootstrap: 779.458s -> 779.323s (-0.02%)
Artifact size: 365.27 MiB -> 365.05 MiB (-0.06%)
Looks like it was a fluke after all.
So, is this patch actually ... needed? Thanks