Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Test out a more lock-free hash map #138419

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

Draft
Zoxc wants to merge 5 commits into rust-lang:master
base: master
Choose a base branch
Loading
from Zoxc:horde-queries
Draft

Conversation

Copy link
Contributor

@Zoxc Zoxc commented Mar 12, 2025

This tests out the more lock-free hash map from my horde crate by using it as the default query map. The integration with DynSync / DynSend in this PR is unsound.

Shards are no longer used for the map, which means all writes are behind a single lock. Reads are lock-free.

Copy link
Collaborator

rustbot commented Mar 12, 2025

r? @Nadrieril

rustbot has assigned @Nadrieril.
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 rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 12, 2025

This comment has been minimized.

Copy link
Member

lqd commented Mar 12, 2025

@bors try @rust-timer queue

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 12, 2025
Copy link
Collaborator

bors commented Mar 12, 2025

⌛ Trying commit 2947bae with merge b73204a...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 12, 2025
Test out a more lock-free hash map
This tests out the more lock-free hash map from my [horde](https://crates.io/crates/horde) crate by using it as the default query map. The integration with `DynSync` / `DynSend` in this PR is unsound.
Shards are no longer used for the map, which means all writes are behind a single lock. Reads are lock-free.
Copy link
Collaborator

bors commented Mar 12, 2025

☔ The latest upstream changes (presumably #138414) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Collaborator

bors commented Mar 12, 2025

☀️ Try build successful - checks-actions
Build commit: b73204a (b73204a7a915c62fc1367f8bdf8f3ff971d2e4c6)

This comment has been minimized.

Copy link
Collaborator

Finished benchmarking commit (b73204a): 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.2% [0.2%, 0.3%] 2
Regressions ❌
(secondary)
1.8% [1.8%, 1.9%] 6
Improvements ✅
(primary)
-0.4% [-1.3%, -0.1%] 35
Improvements ✅
(secondary)
-0.9% [-1.6%, -0.2%] 35
All ❌✅ (primary) -0.4% [-1.3%, 0.3%] 37

Max RSS (memory usage)

Results (secondary 5.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)
6.7% [3.0%, 8.0%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-1.3%, -1.3%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 779.458s -> 783.14s (0.47%)
Artifact size: 365.27 MiB -> 362.93 MiB (-0.64%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 13, 2025
Copy link
Contributor Author

Zoxc commented Mar 13, 2025

Local test with 8 threads / 8 cores:

Benchmark Before After Before After Before After
Time Time % Physical Memory Physical Memory % Committed Memory Committed Memory %
🟣 clap:check 0.4593s 0.4569s -0.52% 203.55 MiB 202.20 MiB -0.67% 270.26 MiB 268.65 MiB -0.60%
🟣 hyper:check 0.1369s 0.1360s -0.61% 128.02 MiB 127.29 MiB -0.57% 192.46 MiB 191.54 MiB -0.47%
🟣 regex:check 0.2915s 0.2898s -0.59% 163.22 MiB 162.03 MiB -0.73% 222.23 MiB 220.81 MiB -0.64%
🟣 syn:check 0.5602s 0.5591s -0.19% 198.26 MiB 197.50 MiB -0.38% 258.15 MiB 257.16 MiB -0.38%
Total 1.4478s 1.4418s -0.42% 693.05 MiB 689.01 MiB -0.58% 943.09 MiB 938.16 MiB -0.52%
Summary 1.0000s 0.9952s -0.48% 1 byte 0.99 bytes -0.59% 1 byte 0.99 bytes -0.52%

Local test with 16 threads / 8 cores:

Benchmark Before After Before After Before After
Time Time % Physical Memory Physical Memory % Committed Memory Committed Memory %
🟣 clap:check 0.4308s 0.4243s 💚 -1.51% 210.82 MiB 209.18 MiB -0.78% 278.63 MiB 276.88 MiB -0.63%
🟣 hyper:check 0.1350s 0.1336s 💚 -1.03% 131.61 MiB 130.79 MiB -0.63% 196.52 MiB 195.54 MiB -0.50%
🟣 regex:check 0.2834s 0.2795s 💚 -1.37% 168.81 MiB 167.36 MiB -0.86% 228.35 MiB 226.61 MiB -0.76%
🟣 syn:check 0.5418s 0.5379s -0.71% 204.90 MiB 204.09 MiB -0.39% 264.86 MiB 263.87 MiB -0.38%
Total 1.3910s 1.3754s 💚 -1.13% 716.14 MiB 711.42 MiB -0.66% 968.35 MiB 962.89 MiB -0.56%
Summary 1.0000s 0.9884s 💚 -1.16% 1 byte 0.99 bytes -0.66% 1 byte 0.99 bytes -0.57%

It does seem to reduce congestion even with the single write lock.

lqd and SparrowLii reacted with thumbs up emoji

Copy link
Contributor Author

Zoxc commented Mar 14, 2025

I added a commit that uses this for type interning also.

Local test with 16 threads / 8 cores for just the type interning change:

Benchmark Before After Before After Before After
Time Time % Physical Memory Physical Memory % Committed Memory Committed Memory %
🟣 clap:check 0.4460s 0.4432s -0.62% 208.13 MiB 165.73 MiB 💚 -20.37% 276.49 MiB 215.77 MiB 💚 -21.96%
🟣 hyper:check 0.1399s 0.1293s 💚 -7.53% 129.73 MiB 89.35 MiB 💚 -31.12% 195.33 MiB 131.10 MiB 💚 -32.89%
🟣 regex:check 0.2890s 0.2789s 💚 -3.47% 166.27 MiB 122.74 MiB 💚 -26.18% 226.41 MiB 163.21 MiB 💚 -27.92%
🟣 syn:check 0.5584s 0.5499s 💚 -1.53% 203.10 MiB 159.39 MiB 💚 -21.53% 263.71 MiB 200.96 MiB 💚 -23.79%
Total 1.4333s 1.4014s 💚 -2.22% 707.23 MiB 537.21 MiB 💚 -24.04% 961.94 MiB 711.03 MiB 💚 -26.08%
Summary 1.0000s 0.9671s 💚 -3.29% 1 byte 0.75 bytes 💚 -24.80% 1 byte 0.73 bytes 💚 -26.64%

It does seem like sharding wasted quite a bit of memory.

Copy link
Member

lqd commented Mar 14, 2025

We can do another perf run if you’d like, but the conflicts would need to be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /