HeadlinesBriefing favicon HeadlinesBriefing.com

High-Performance C++20 LRU Hash Table

Hacker News •
×

A new C++20 LRU hash table, developed by adanil-code, offers a high-performance, cross-platform solution for demanding systems programming. It addresses standard library bottlenecks by employing a sharded architecture, array-backed memory management, and custom TTAS spinlocks.

Key features include zero runtime allocations, NUMA awareness, and a focus on cache locality. The table is partitioned into independent shards, each with its own lock and capacity, scaling linearly with CPU cores. This design eliminates global lock contention, a major issue in standard library implementations on multi-core systems.

The implementation prioritizes mechanical sympathy, cache alignment, and predictable memory behavior. It supports both user-mode and Windows Kernel (IRQL < DISPATCH_LEVEL) environments, making it suitable for applications like High-Frequency Trading, storage caching, and network infrastructure. Performance benchmarks indicate significant throughput improvements and sub-microsecond tail latencies compared to traditional approaches. The project aims for O(1) average-time operations with a strict or probabilistic LRU eviction policy, supporting up to 2^32 elements.