Skip to content

DDIR Corgi chunks: reuse sort labels during consolidation - #908

Merged
frankmcsherry merged 1 commit into
master-nextfrom
ddir-sort-labels
Sep 28, 2026
Merged

frankmcsherry merged 1 commit into
master-nextfrom
ddir-sort-labels

Conversation

@frankmcsherry

Copy link
Copy Markdown
Member

Consolidating a columnar chunk used to gather the sorted payload and then compare adjacent rows again. Corgi's sort already computes equality labels for (key, value) runs. This keeps those labels, works in original row coordinates, and gathers only the surviving rows, once. It also drops the extra payload index vector. The zero-copy path for payloads that are already ordered and all survive is kept, including time reordering inside runs of equal values. One file, +63/−15, including an oracle test over payload, time and cancellation.

Measured on SCC, the worldgen tour, and the stock AoC runner. Three paired runs each, order reversed in the middle run, M4 release build:

Workload / workers Initial ms Ten churn ticks ms Process CPU s Peak footprint MiB
scc 1 70.95 → 69.36 (−2.2%) 777.62 → 771.95 (−0.7%) 0.84 → 0.83 79.8 → 83.1 (+4.2%)
scc 4 32.60 → 31.97 (−1.9%) 375.53 → 374.63 (−0.2%) 1.63 → 1.63 82.7 → 92.1 (+11.3%)
tour 1 1520 → 1540 (+1.3%) 326.49 → 330.79 (+1.3%) 1.84 → 1.86 (+1.1%) 37.2 → 36.2 (−2.8%)
tour 4 1750 → 1750 365.64 → 362.87 (−0.8%) 3.41 → 3.41 43.2 → 44.8 (+3.6%)
AoC workers Runner elapsed s Process CPU s
1 2.12 → 2.04 (−3.8%) 2.14 → 2.05 (−4.2%)
4 2.24 → 2.17 (−3.1%) 8.57 → 8.27 (−3.5%)

Slower cases.

  • SCC peak at 1 worker rises 4.2%, in every pair, with ranges that do not overlap.
  • At 4 workers the median rises 11.3%, but the ranges overlap and one pair goes the other way.
  • Tour peak at 4 workers is also up at the median.
  • Tour at 1 worker is about 1.3% slower.

Fewer copies overall does not mean a lower peak, and this change does not save memory.

Context. In worldgen, on top of other changes, this gives first view −7.1% / −5.7% and tour −7.3% / −5.8% at 1 / 3 workers.

Tests. cargo test --release -p interactive: 105 passed, 5 ignored (all ignored before this change too). All 33 AoC answers match. The supported sessions and the graph references match on both backends.

This PR and the uniform-timestamp PR edit the same function. They were measured separately and do not depend on each other. Whichever lands second will need a small rebase.

Measurements and the port are by Astra (OpenAI Codex). I re-ran the tests on master-next 9cfc909.

🤖 Generated with Claude Code

Corgi already refines labels to identify equal (key, value) runs when sorting.
Keep these labels instead of gathering the sorted payload and comparing its
adjacent rows again. Use original row coordinates through consolidation and
gather only the surviving rows, once. Drop the redundant payload index vector.
Retain the existing zero-copy path for ordered, surviving payloads, including
time reordering inside equal-value runs.

Co-Authored-By: Astra (OpenAI Codex)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@frankmcsherry
frankmcsherry merged commit 5fd3ecc into master-next Sep 28, 2026
6 checks passed
@frankmcsherry
frankmcsherry deleted the ddir-sort-labels branch September 28, 2026 23:44
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