Skip to content

Refactor LRU policy to use a pool-based design for allocation-free pe…#36

Merged
TKorr merged 1 commit intomainfrom
refactor/lru-cache-slotted-arena
Feb 27, 2026
Merged

Refactor LRU policy to use a pool-based design for allocation-free pe…#36
TKorr merged 1 commit intomainfrom
refactor/lru-cache-slotted-arena

Conversation

@TKorr
Copy link
Contributor

@TKorr TKorr commented Feb 27, 2026

…rformance

  • Transitioned to a SlotArena for contiguous storage of nodes, enabling O(1) slot reuse and eliminating heap allocations during steady state.
  • Updated core data structures to utilize FxHashMap for key-to-slot lookup and maintain a doubly-linked order via SlotId indices.
  • Enhanced concurrency support with a ConcurrentLruCache wrapper, detailing read/write lock requirements for operations.
  • Revised documentation to reflect architectural changes, including node layout, allocation strategy, and safety invariants, ensuring clarity on performance and usage.

Description

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or modification

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Test environment:

  • OS:
  • Rust version:

Checklist

  • My code follows the project's coding standards
  • I have run cargo fmt and cargo clippy
  • I have added tests for my changes
  • All new and existing tests pass (cargo test)
  • I have updated the documentation as needed
  • I have added an entry to CHANGELOG.md (if applicable)

Screenshots (if applicable)

Additional Notes

…rformance

- Transitioned to a `SlotArena` for contiguous storage of nodes, enabling O(1) slot reuse and eliminating heap allocations during steady state.
- Updated core data structures to utilize `FxHashMap` for key-to-slot lookup and maintain a doubly-linked order via `SlotId` indices.
- Enhanced concurrency support with a `ConcurrentLruCache` wrapper, detailing read/write lock requirements for operations.
- Revised documentation to reflect architectural changes, including node layout, allocation strategy, and safety invariants, ensuring clarity on performance and usage.
@TKorr TKorr self-assigned this Feb 27, 2026
@TKorr TKorr merged commit 2375826 into main Feb 27, 2026
16 checks passed
@TKorr TKorr deleted the refactor/lru-cache-slotted-arena branch February 27, 2026 16: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.

1 participant