66[ ![ Build Status] ( https://github.com/avoidwork/tiny-lru/actions/workflows/ci.yml/badge.svg )] ( https://github.com/avoidwork/tiny-lru/actions )
77[ ![ Test Coverage] ( https://img.shields.io/badge/coverage-100%25-brightgreen.svg )] ( https://github.com/avoidwork/tiny-lru )
88
9- The ** fastest, smallest, and most reliable ** LRU cache for JavaScript! Built for developers who need ** blazing- fast performance ** without compromising on bundle size or features.
9+ A ** high-performance, lightweight ** LRU cache for JavaScript with ** industry-leading UPDATE operations ** and the ** smallest bundle size ** among full-featured libraries. Built for developers who need fast caching without compromising on features.
1010
11- > ** Just 2.3KB** • ** 340K+ UPDATE ops/sec** • ** 100% TypeScript support** • ** Works everywhere**
11+ > ** Just 2.3KB** • ** 348K UPDATE ops/sec** • ** 100% TypeScript support** • ** Works everywhere**
1212
1313``` javascript
1414import {lru } from " tiny-lru" ;
@@ -27,27 +27,27 @@ tempCache.set('session', 'abc123'); // Automatically expires after 5 seconds
2727
2828### Performance That Leads the Pack
2929
30- | Operation | Tiny LRU | lru-cache | quick-lru |
31- | -----------| ----------| -----------| -----------|
32- | ** UPDATE** | ** 340,187 ops/sec** 🥇 | 120,495 ops/sec | 327,171 ops/sec |
33- | ** DELETE** | ** 342,009 ops/sec** 🥇 | 153,116 ops/sec | 395,741 ops/sec |
34- | ** GET** | 120,277 ops/sec | 99,815 ops/sec | ** 117,901 ops/sec** |
35- | ** SET** | 41,826 ops/sec | 26,930 ops/sec | ** 51,533 ops/sec** |
36- | ** Bundle Size** | ** 2.3KB** 🥇 | ~ 15KB | ~ 1.8KB |
30+ | Library | SET ops/sec | GET ops/sec | UPDATE ops/sec | DELETE ops/sec | Bundle Size | Memory/Item |
31+ | ---------| -------------| -------------| ---------------| ---------------| -------------| -------------|
32+ | ** tiny-lru** | 43,022 | 113,531 | ** 348,829** 🥇 | ** 335,038** 🥇 | ** 2.3KB** 🥇 | 185 bytes |
33+ | lru-cache | 27,819 | 96,739 | 133,706 | 149,700 | ~ 15KB | ** 114 bytes** 🥇 |
34+ | quick-lru | ** 52,200** 🥇 | 118,758 | 321,377 | ** 391,763** 🥇 | ~ 1.8KB | 176 bytes |
35+ | mnemonist | 29,933 | ** 192,073** 🥇 | 210,628 | N/A† | ~ 45KB | ** 99 bytes** 🥇 |
3736
37+ † * mnemonist uses different method names for delete operations*
3838* Benchmarks run on Node.js v24.5.0, Apple Silicon (M4)*
3939
4040### 🎯 ** Key Highlights**
41- - ** 🚀 340K+ UPDATE operations per second** - Industry-leading performance for cache updates
41+ - ** 🚀 348K UPDATE operations per second** - Leads the field in cache update performance
4242- ** 📦 Just 2.3KB minified** - Smallest bundle among full-featured LRU libraries
43- - ** ⚡ O(1) complexity** - Lightning-fast operations that scale
43+ - ** ⚡ O(1) complexity** - Consistent performance that scales
4444- ** 🛡️ 100% test coverage** - Battle-tested and reliable
4545- ** 🌐 Universal compatibility** - Works in Node.js and browsers
4646- ** 📝 Full TypeScript support** - Complete type definitions included
4747
4848## ✨ Features
4949
50- - 🚀 ** Industry- Leading Performance** - 340K+ UPDATE ops/sec, optimized O(1) operations
50+ - 🚀 ** Leading UPDATE Performance** - 348K UPDATE ops/sec, optimized O(1) operations
5151- 💾 ** Smallest Bundle** - Just 2.3KB minified among full-featured LRU libraries
5252- ⏱️ ** TTL Support** - Optional time-to-live with automatic expiration
5353- 🔄 ** Method Chaining** - Fluent API for better developer experience
@@ -60,12 +60,12 @@ tempCache.set('session', 'abc123'); // Automatically expires after 5 seconds
6060
6161### Real-World Benchmarks
6262
63- ** Typical performance on modern hardware:**
64- - ** SET operations** : ~ 42,000 ops/sec
65- - ** GET operations** : ~ 120,000 ops/sec (cache hits)
66- - ** UPDATE operations** : ~ 340,000 ops/sec (existing keys)
67- - ** DELETE operations** : ~ 342,000 ops/sec
68- - ** Memory footprint** : ~ 185 bytes per cached item
63+ ** Validated performance on modern hardware (Node.js v24.5.0, Apple Silicon M4) :**
64+ - ** SET operations** : 43,022 ops/sec
65+ - ** GET operations** : 113,531 ops/sec (cache hits)
66+ - ** UPDATE operations** : 348,829 ops/sec (existing keys)
67+ - ** DELETE operations** : 335,038 ops/sec
68+ - ** Memory footprint** : 185 bytes per cached item
6969
7070### When to Choose Tiny LRU
7171
0 commit comments