Skip to content

perf(scoring): retain only filter-accepted join rows, without identity tables - #291

Merged
blackopsrepl merged 9 commits into
mainfrom
perf/join-retention
Dec 1, 2026
Merged

blackopsrepl merged 9 commits into
mainfrom
perf/join-retention

Conversation

@blackopsrepl

Copy link
Copy Markdown
Collaborator

Joins no longer retain rows their stream filter rejects, and no longer keep identity tables to deduplicate output.

What changes

  • JoinNode emits each pair once without the global outputs map: a pair is only found twice in one change when both of its rows were inserted by that change, so the right probe skips left rows stamped with the current change. A per-input live map keeps repeated insertion a no-op.
  • SelfJoinNode keeps each row's key and bucket position and each combination's link positions. Retraction previously scanned every key bucket to find the row's key, and called retain on each member's tuple list; it now touches only the row's own bucket and combinations. The combos map is gone, and inserting a live row is now a no-op (it used to be pushed into its bucket twice).
  • ComplementNode drops real_outputs the same way.
  • Every fluent stream filter (bi, tri, quad, penta, flattened bi, the tri/quad/penta group_by inputs and all same-collection streams) is now the row filter of the join it reads: JoinNode::filtered, SelfJoinNode::filtered. It runs when a row is found, before the row is retained, so rejected rows cost one predicate call and nothing else. The BiScored/TriScored/QuadScored/PentaScored/FlattenedBiScored wrappers and the FilterNodes over joins are removed. FilterPredicate gains ACCEPTS_ALL (default false; true for AcceptAll), so an unfiltered self-join never resolves a combination only to test it.
  • Chain::filter keeps its FilterNode: Chain::new accepts any operator tree.

Public API: JoinNode and SelfJoinNode gain a defaulted row-filter parameter, plus filtered constructors, AcceptAll, SelfJoinRowFilter and FilterPredicate::ACCEPTS_ALL. Existing code compiles unchanged. public-api.txt, the scoring wireframe and docs/extend-scoring.md are updated.

Verification

  • make test, make lint (incl. public-api, doc-names, file-length), cargo clippy --workspace --all-targets --all-features -D warnings.
  • New tests: self-join key churn at arity 2 and 3 against full evaluation (fails when the link-position repair is removed), and a complement whose targets and results share a descriptor (fails when the same-change skip is removed).
  • New gate case scoring_joins (self-join, same-source cross join, filtered cross join), gate-smoke.sh v0.31.5 scoring_joins 32: equal order_hash and score identity_hash; wall 812 ms → 68 ms, allocations 2,202,055 → 6,829, peak live bytes 10.0 MB → 0.53 MB.
  • hospital-scale hs-e10000-s100000, 60 s on one core, bench adapter built against each tree: v0.31.5 places 45,074 shifts (−54,926 hard), this branch places all 100,000 in 58.8 s (0 hard); 7.23 → 3.10 µs per evaluated construction move.

The full zero-regression gate runs on merged main against v0.31.5.

@blackopsrepl
blackopsrepl merged commit 41d4205 into main Dec 1, 2026
7 checks passed
@blackopsrepl
blackopsrepl deleted the perf/join-retention branch December 1, 2026 21:38
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