Rewrite rustc_span::symbol::Interner to avoid double hashing#157252
Rewrite rustc_span::symbol::Interner to avoid double hashing#157252heinwol wants to merge 2 commits into
rustc_span::symbol::Interner to avoid double hashing#157252Conversation
Involves resorting to raw `HashTable` and writing an ad-hoc `IndexMap`-like structure, as we cannot get access to raw hashes otherwise. My local cachegrind profile shows ~ -20_000_000 Ir
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
|
@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.
Rewrite `rustc_span::symbol::Interner` to avoid double hashing
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (e66b004): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in 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.6%, secondary 1.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 509.892s -> 512.954s (0.60%) |
|
The red numbers in |
The original implementation used a single `rustc_data_structures::sync::lock::Lock` for both reads and writes, which _allegedly_ caused unnecessary lock contention for read-heavy highly-parallelized scenarios. Now we have 2 locks: `RwLock` for the symbol map and `Lock` for the arena
|
I've added locking enhancements to reduce contention, maybe this will cause some improvement (or maybe the contrary). Of course, this is only relevant in multithreaded benches, i'm not sure if we can reliably test this. Also, due to my lack of experience, I'd like a more professional look at whether I have some concurrency bugs. I think I've mitigated the TOCTOU and locking order is deterministic. My benches and tests run fine. |
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
Involves resorting to raw
HashTableand writing an ad-hocIndexMap-like structure, as we cannot get access to raw hashes otherwise.My local cachegrind profile shows ~ -20_000_000 Ir
r? @petrochenkov