Skip to content

feat: add eviction policy engine (LFU + prefix-aware)#13

Open
stmatengss wants to merge 1 commit into
mainfrom
feat/eviction-policies
Open

feat: add eviction policy engine (LFU + prefix-aware)#13
stmatengss wants to merge 1 commit into
mainfrom
feat/eviction-policies

Conversation

@stmatengss

Copy link
Copy Markdown
Collaborator

Summary

  • Add LFU eviction policy to Python oracle (oracle/lfu.py)
  • Add prefix-aware eviction policy (oracle/prefix_aware.py) — never evicts parent blocks while children are resident
  • Add compare-policies CLI command to benchmark all 4 policies (Belady/LRU/LFU/prefix-aware) on a trace
  • Add eviction policy selector dropdown to web calculator with POLICY_EFFICIENCY_DEFAULTS

Test plan

  • Python unit tests: pytest tests/test_lfu.py tests/test_prefix_aware.py -v
  • JS parity: node tests/validate_js_parity.mjs (178 checks pass)
  • Web calculator: verify policy dropdown updates LRU-like efficiency

🤖 Generated with Claude Code

…s CLI

Add two new eviction policy implementations to the oracle engine:
- LFU (Least Frequently Used): evicts blocks with lowest access frequency,
  ties broken by earliest insertion order
- Prefix-Aware: never evicts parent blocks while their children are resident,
  among leaf nodes evicts by LFU

Add compare-policies CLI command that runs all 4 policies (Belady, LRU, LFU,
prefix-aware) on a trace and outputs a JSON comparison.

Add eviction policy selector dropdown to the web calculator with
POLICY_EFFICIENCY_DEFAULTS (lru: 0.55, lfu: 0.62, prefix_aware: 0.78)
that updates the lru_like efficiency parameter unless manually overridden.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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