Skip to content

perf(scoring): reuse emptied output-link buckets across notifications - #281

Merged
blackopsrepl merged 1 commit into
mainfrom
perf/pooled-link-buckets
Nov 28, 2026
Merged

blackopsrepl merged 1 commit into
mainfrom
perf/pooled-link-buckets

Conversation

@blackopsrepl

Copy link
Copy Markdown
Collaborator

Change and Purpose

Join, complement, projection and self-join nodes kept one bucket of output handles per input row and dropped it whenever the row was retracted, so every move that re-joined rows allocated two small vectors per output pair (about 195k allocations in one group_ruin gate run). The buckets now live in a Links table that pools emptied buckets, so steady-state notification allocates nothing.

The churn also coupled scoring's memory layout to the selectors' allocations: the full gate of 6421406e against v0.31.3 failed only group_ruin on simulated D1 misses (+6.3%, identical instructions) because the selectors stopped freeing per-step tables that scoring used to reuse.

Verification

  • crates/solverforge-solver/tests/join_link_reuse.rs: 64 re-joining moves allocate 0 times (128 on main).
  • Cachegrind vs v0.31.3 with the gate's features: group_ruin Ir -7.2%, D1 +0.6%; route_rows Ir -7.8%, D1 -3.6%.
  • make lint and make test pass (1664 tests).
  • The full zero-regression gate runs on merged main.

Join, complement, projection and self-join nodes keep one bucket of output handles per input row. Retracting the row dropped its bucket and re-inserting it allocated a new one, so every move that re-joined rows allocated two small vectors per join output pair: about 195k allocations in one group_ruin gate run. The nodes now hold their buckets in a Links table that hands emptied buckets back to a pool, so steady-state notification allocates nothing. A counting-allocator test pins it (128 allocations over 64 moves before, 0 after).

Besides the allocations themselves, the churn tied scoring's memory layout to whatever the selector freed last: the zero-regression gate's group_ruin case read 6.3% more simulated D1 misses after the move selectors stopped freeing their per-step tables, with identical instructions. With the pool, group_ruin runs 7.2% fewer instructions than 0.31.3 at +0.6% D1 misses, and route_rows 7.8% fewer instructions at -3.6% D1 misses.
@blackopsrepl
blackopsrepl force-pushed the perf/pooled-link-buckets branch from 63ebcb2 to 145def1 Compare November 28, 2026 05:55
@blackopsrepl
blackopsrepl merged commit 145def1 into main Nov 28, 2026
7 checks passed
@blackopsrepl
blackopsrepl deleted the perf/pooled-link-buckets branch November 28, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant