Skip to content

perf: reuse L1 allocations and avoid contention-driven flushes - #66

Merged
leiysky merged 4 commits into
mainfrom
dev/cache-admission-l1-reuse
Oct 27, 2026
Merged

leiysky merged 4 commits into
mainfrom
dev/cache-admission-l1-reuse

Conversation

@leiysky

@leiysky leiysky commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Foreground staging no longer treats lock collisions as buffer pressure. Retain Region capacity requests through the final write, including when staging is full and its next flush requires alignment padding, so one capacity rejection is enough to trigger flush and rotation. A staging record-count limit only rotates when the next record cannot fit; duplicate wakes leave the new Region idle.

Reuse detached, exclusively owned L1 allocations of the exact size and skip eviction-counter updates when no eviction occurred. Caller-held values remain immutable and retain their memory charge. Count CacheSnapshot::served_bytes from the final returned value after L2 promotion, including when a concurrent publication supplies a newer L1 value of a different size.

Regression coverage includes CLOCK/S3-FIFO ownership and accounting, concurrent publication and final-owner drops, full buffers, automatic rotation, fixed routing after reclaim, and warm reopen. Permanent boundary tests cover 1,152 alignment/rotation combinations, 12 staging exact-fit/overflow cases, and 16 promotion/retained-charge cases, including empty values and statistics on/off.

Validation

Targets current main directly. Benchmark harness and comparison tooling are in #67.

@leiysky
leiysky merged commit 3d29b6e into main Oct 27, 2026
8 checks passed
@leiysky
leiysky deleted the dev/cache-admission-l1-reuse branch October 27, 2026 16:25
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