Replace LRU/MRU/FIFO/LFU with SIEVE eviction#20
Merged
Conversation
Unify the eviction algorithm to SIEVE for both the in-process memory backend and the cross-process shared memory backend. This simplifies the codebase (removes ~540 lines), eliminates the `strategy` parameter and `Strategy` enum, and makes shared memory reads fully lock-free (visited bit is set via an idempotent store, no write lock needed). Key changes: - Shared memory: replace multi-strategy dispatch with sieve_evict() - Layout VERSION bumped 2→3 (forces recreation of old mmap files) - All reads on shared backend are now lock-free (previously only FIFO) - Remove src/strategies/ module entirely (memory backend uses inline SIEVE) - Remove Strategy enum from Python API; cache() no longer takes strategy= Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all references to LRU/MRU/FIFO/LFU strategy selection with SIEVE eviction across README, usage guide, performance docs, alternatives comparison, benchmarks, llms.txt, examples, and CLAUDE.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run benchmarks after SIEVE migration to capture improvements: - Shared backend: 7.8M → 8.9M ops/s (lock-free reads via visited bit) - Multi-process 4 procs: 3.1M → 7.7M ops/s (2.5x improvement) - Multi-process 8 procs: 1.9M → 6.5M ops/s (3.4x improvement) - Hit rate: 64.9% → 72.7% (SIEVE scan-resistant eviction) Also fix bench_runner SharedCachedFunction calls (removed old strategy arg). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memory) and cross-process (shared) backends now use SIEVE — a simple, scan-resistant algorithm with near-optimal hit ratesvisitedbit is set via an idempotent store with no lockstrategyparameter andStrategyenum —cache()now just works with SIEVE, no configuration neededsrc/strategies/module (5 files), simplifiedordering.rsfrom multi-strategy dispatch to a singlesieve_evict()function_reserved→sieve_hand,frequency→visited)Files changed (27 files, -540 net lines)
layout.rs,ordering.rs,mod.rs,region.rsstore.rs,entry.rs,strategies/(deleted)_decorator.py,_strategies.py,__init__.py,.pyistrategyparam andStrategyenumTest plan
cargo clippy -- -D warnings— no warningsruff check+ty check— all cleanpytest tests/ -v— all 72 tests passwrite_lock()in get path)🤖 Generated with Claude Code