Skip to content

A counter series at its cap trims without building a list - #3164

Open
matrixarkai wants to merge 1 commit into
mainfrom
perf/a-series-at-its-cap-trims-without-a-list
Open

matrixarkai wants to merge 1 commit into
mainfrom
perf/a-series-at-its-cap-trims-without-a-list

Conversation

@matrixarkai

Copy link
Copy Markdown
Owner

Change

The trim to control_state_max_size collected the keys to drop into a Vec<u64> before removing them, so a series sitting at its cap allocated on every write to a new bucket (twice when the block was due). It now takes the oldest point off the front with pop_first, the same points in the same order.

No durable byte, wire byte or answer changes: the points kept, the answer, the staged outcome and every written byte are unchanged.

Guards (no absolute calibration)

  • a_bounded_series_keeps_its_newest_points_whatever_the_write_order: ascending, descending, repeating and shuffled writes at a bound of 6, series compared with a model after every write.
  • probe::a_write_at_the_cap_allocates_what_a_write_below_it_allocates (alloc-probe, ignored): the same new-bucket writes, block forced on both arms, at the cap versus far below it; the difference must be under 0.3 blocks.

What was NOT done

No local build, test run or plant was run for this change: the shared build lock queue is more than twenty deep, so CI is the first compile. There is no before/after allocation table yet; a measurement run through the counting allocator is still queued and its table will be posted as a comment on this PR. Until then, the allocation claim above is from reading the code, not from a measurement. The plant (revert the change, the guard must fail) has also not been run.

🤖 Generated with Claude Code

@matrixarkai
matrixarkai removed the request for review from bjmeetsfo November 15, 2026 21:46
@matrixarkai
matrixarkai force-pushed the perf/a-series-at-its-cap-trims-without-a-list branch from 3d1969a to 333e20c Compare November 15, 2026 23:41
@matrixarkai

Copy link
Copy Markdown
Owner Author

Measured BEFORE this change, on main at d301b20 (before any of the four lever PRs), release build, rustc 1.89.0, --features alloc-probe, counting allocator through engine.execute, 400 operations per row, values in allocation blocks and bytes per operation. Planted-loop control reported exactly its allocations (1, 1000, 12345). One caveat: the harness control that repeats a hash-write scenario twice and requires equal counts FAILED; the rows below repeat to within 0.3 blocks across their own E and K sweeps, but treat them as indicative, not exact. The AFTER table is from a build of current main and will follow.

Counter increment at the cap versus below it (K=8, cap = E): at the cap 30.64 / 30.87 / 30.40 blocks for E=10 / 100 / 1000; below the cap 29.85 / 29.89 / 29.46. So a write at the cap costs about 0.8 to 1.0 blocks more, which is the victim list this change removes (the increment path trims once per write, and the block is due on about one in sixteen).

See the pull request description for what moved and what was not measured.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@matrixarkai
matrixarkai force-pushed the perf/a-series-at-its-cap-trims-without-a-list branch from 333e20c to a340c48 Compare November 16, 2026 04:17
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.

2 participants