Skip to content

Speed up cache inserts and removals - #141

Merged
arthurprs merged 3 commits into
masterfrom
perf/ghost-eviction
Nov 21, 2026
Merged

arthurprs merged 3 commits into
masterfrom
perf/ghost-eviction

Conversation

@arthurprs

@arthurprs arthurprs commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Builds on the ghost sizing changes in #140.

  • Single-ghost eviction takes the hash from the removed slab entry. The cold hand inlines this path, and bulk trimming runs in a separate loop.
  • Slab linkage uses the same neighbor updates for singleton and longer rings.
  • Exact-key removal deletes through the occupied hash-table entry returned by its lookup. A matching ghost hash serves as a fallback if the lookup finds no exact key.

Benchmarks

  • Steady-state inserts with mixed weights took 3–5% less time.
  • Removal of existing keys took 3–5% less time.

Validation

The default suite passed 90 tests with one ignored doctest. The reserve tests also passed with stats and without default features.

@arthurprs
arthurprs force-pushed the perf/ghost-eviction branch 5 times, most recently from dd1bcbc to 12db029 Compare November 21, 2026 23:23
A one-entry ring has its head as its own predecessor. The same
updates link the new entry in rings of any length.
Keep the occupied bucket for an exact hit and invalidate its placeholder
before removing it. Use the ghost token when the exact-key probe misses.
@arthurprs
arthurprs changed the base branch from feat/len-based-ghost-sizing to master November 21, 2026 23:36
@arthurprs
arthurprs marked this pull request as ready for review November 21, 2026 23:41
@arthurprs arthurprs changed the title Inline single ghost eviction and outline bulk trimming Speed up cache inserts and removals Nov 21, 2026
@arthurprs
arthurprs merged commit 4cdf58d into master Nov 21, 2026
12 checks passed
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