New S3-FIFO algorithm hits 15.5M ops/sec in Node.js, challenging LRU cache dominance
A developer has built a high-performance Node.js cache library called s3fifo, implementing the S3-FIFO algorithm — which uses three simple FIFO queues — instead of the widely used LRU approach. The library achieves 15.5 million operations per second by eliminating garbage collection pressure through flat parallel arrays and zero runtime object allocations. S3-FIFO addresses a key weakness of LRU caches known as cache pollution, where one-time access patterns such as database scans or crawler traffic can displace frequently used data. Low-level V8 optimizations, including bitwise metadata packing and power-of-two ring buffers to avoid costly modulo operations, contribute to the performance gains. The project raises questions about whether developers should re-evaluate their default reliance on established cache packages like lru-cache.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in