Repository navigation
Scope intermediate marker cover nodes to conversion - #22665
charliermarsh wants to merge 4 commits into
Conversation
Borrow existing marker nodes and cached operations through a read-only parent interner. Keep new ISOP nodes and operation-cache entries in a temporary interner, and render owned expressions before dropping it.
Merging this PR will degrade performance by 22.89%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
8602037 to
551c17c
Compare
Based on #22651.
We extract marker covers through a temporary interner that borrows existing nodes and cached operations from the global interner. New decision nodes and operation-cache entries belong to the conversion and are dropped after we render the cover into owned marker expressions.
This keeps intermediate ISOP functions from accumulating across distinct markers without adding another simplification implementation or changing the persistent marker representation. We reuse the same algebra and cover extraction code, but give their scratch state a shorter lifetime.
The tradeoff is that repeated conversions rebuild intermediate nodes instead of reusing them indefinitely. The regression test checks that cover extraction creates temporary nodes while leaving the parent's node table and operation cache unchanged.
Warm performance
Median time per operation in microseconds. Marker construction is outside the timed loop; each process reuses the global interner. Three randomized-order cohorts, with 16 timed samples per workload and revision, pinned to CPU 4 on an otherwise quiet devbox:
The small DNF cases add about 65–75 ns. The 32-extra conflict case adds 19 µs but remains about 46 times faster than the old stack. These are microbenchmarks, not an end-to-end resolver measurement; small differences in unchanged controls should be treated as noise. The reported run had no sustained competing work. The parent interner remains locked through cover rendering, with sorting outside the lock; these single-threaded measurements do not measure contention with other marker operations.
First conversion in a fresh process
Median of 20 randomized fresh-process samples, in microseconds. Input construction and process startup are outside the timer; allocator and code paths are cold:
Cold small-call results vary at the microsecond scale; they do not show the systematic warm-cache advantage of #22651.
Retained memory
Final live heap after constructing and converting distinct four-extra conflict markers in one process, with outputs dropped:
Each conversion retains zero additional bytes in this PR. Input construction still grows the persistent marker interner; we remove the additional growth from extracting covers. At 1,024 markers, peak RSS was 30.1 MiB for the old stack, 52.1 MiB for #22651, and 29.4 MiB for this PR. RSS is a coarse corroborating measurement; the table counts live Rust-requested allocation bytes over uv's Linux jemalloc allocator, not allocator metadata or reserved pages.
The benefit depends on allocation history: the full 25-workload sequence and a history of 64 distinct 32-extra markers ended with the same live heap in all three versions, since the extra nodes fit within already-allocated tables. The four-extra history above exposes the retained-capacity growth.
Peak working heap
Peak additional live heap during a warmed operation, excluding the already-built input and any state retained by earlier conversions:
The temporary arena raises transient memory on conflict workloads because we rebuild scratch state instead of retaining it between calls. Those allocations are freed after each conversion. For the four-extra case, #22651's first-call peak is 48.10 KiB, compared with 14.92 KiB here. The other listed cases have the same first-call and warmed peaks. Allocation counts were repeated in three fresh-process cohorts across all 25 workloads.
Measured on an AMD EPYC Milan Linux devbox with Rust 1.99.0-dev / Ohm 1.99.0-3. Revisions: #22642 at
21f4b07ecd5277ea4ee31d13c6ff71d49a85b754, #22651 atf9df0b826c93cecedab61c6594faa436e641867a, and this PR at3867ce592925071fc9a1acdf7a0aa34a3e2d8657.