perf: Rework read deduplication with pooled read recorders#158794
perf: Rework read deduplication with pooled read recorders#158794xmakro wants to merge 1 commit into
Conversation
d12f6c8 to
9ba059f
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.
perf: Rework read deduplication with pooled epoch filtered recorders
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (f859e1d): 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 3.0%, secondary 2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -4.2%, secondary -3.6%)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: 489.956s -> 490.746s (0.16%) |
9ba059f to
f5397c8
Compare
|
The perf results are up to date, the last push only changed comments. One question is whether the memory usage of the amortized u32 IndexVecs is acceptable. If not, there are two fallbacks: keeping the old hashset combined with the pool should get ~40% of this PR's instruction improvement, and a bitmask should get ~66% while using 32x less memory than the u32 IndexVec. cc @cjgillot and @nnethercote who might be interested. |
There was a problem hiding this comment.
Thanks for the PR. The perf improvements are great!
One question is whether the memory usage of the amortized u32 IndexVecs is acceptable. If not, there are two fallbacks: keeping the old hashset combined with the pool should get ~40% of this PR's instruction improvement, and a bitmask should get ~66% while using 32x less memory than the u32 IndexVec.
I'd suggest to start with a PR that implements the pool and keeps hashsets. Then we will be able to perf the bitset and the u32 indexvec in isolation.
|
The icount and cycles results look fantastic! But the wall-time numbers look like a net loss, and max-rss is also worse :( (We normally look at icounts because for most changes only icounts has enough precision to give a meaningful comparison, but for changes with big perf effects like this one, wall-time is the ultimate metric.) |
f5397c8 to
8df8d2f
Compare
|
Thanks @cjgillot and @nnethercote for taking a look so quickly, and @Kobzol for the perf run. I changed the PR to use a hash set as suggested, and also moved the max operation to the encoder, which allows some cleanup. The higher max-rss was expected with the IndexVec, but the higher wall-time is odd, since the PR really avoids work. With the hash set, max-rss should match master, at the cost of about half of the instructions and cycles improvement. Let's see how the timings look with a new perf run. |
Every dependency read goes through DepGraph::read_index, which must decide whether the current task has already recorded the read. Small tasks used a linear scan; larger ones built an FxHashSet, rebuilt for every task and rehashed as it grew, while the reads themselves were collected in an EdgesVec allocated and freed per task.
Larger tasks now reuse a recorder from a global pool, so the hash set and read list allocations are amortized across tasks. EdgesVec is removed.