Skip to content

Conversation

@cesco69
Copy link

@cesco69 cesco69 commented Jan 9, 2026

🚀 LRU Cache Library Comparison Benchmark

Cache Size: 1000 items
Iterations: 10.000
Node.js: v24.0.1
Platform: win32 x64

📊 SET Operations Benchmark
==================================================
┌─────────┬─────────────────────┬──────────────────┬───────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name           │ Latency avg (ns) │ Latency med (ns)  │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼─────────────────────┼──────────────────┼───────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'tiny-lru set'      │ '10531 ± 14.17%' │ '4600.0 ± 300.00' │ '198680 ± 0.13%'       │ '217391 ± 13310'       │ 189915  │
│ 1       │ 'tiny-lru-ttl set'  │ '15619 ± 12.14%' │ '9200.0 ± 500.00' │ '101357 ± 0.14%'       │ '108696 ± 5603'        │ 128048  │
│ 2       │ 'lru-cache set'     │ '6285.4 ± 1.09%' │ '5500.0 ± 300.00' │ '178130 ± 0.06%'       │ '181818 ± 10490'       │ 318198  │
│ 3       │ 'lru-cache-ttl set' │ '8660.9 ± 0.65%' │ '7800.0 ± 300.00' │ '124538 ± 0.07%'       │ '128205 ± 5128'        │ 230923  │
│ 4       │ 'quick-lru set'     │ '2939.8 ± 0.79%' │ '2400.0 ± 300.00' │ '397303 ± 0.06%'       │ '416667 ± 46296'       │ 680321  │
│ 5       │ 'mnemonist set'     │ '5988.8 ± 0.94%' │ '3900.0 ± 200.00' │ '236226 ± 0.09%'       │ '256410 ± 13860'       │ 333955  │
└─────────┴─────────────────────┴──────────────────┴───────────────────┴────────────────────────┴────────────────────────┴─────────┘

📊 GET Operations Benchmark
==================================================
┌─────────┬─────────────────────┬──────────────────┬───────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name           │ Latency avg (ns) │ Latency med (ns)  │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼─────────────────────┼──────────────────┼───────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'tiny-lru get'      │ '1350.5 ± 0.05%' │ '1300.0 ± 100.00' │ '750841 ± 0.01%'       │ '769231 ± 54945'       │ 1480980 │
│ 1       │ 'tiny-lru-ttl get'  │ '5442.8 ± 0.05%' │ '5400.0 ± 100.00' │ '185228 ± 0.02%'       │ '185185 ± 3494'        │ 367460  │
│ 2       │ 'lru-cache get'     │ '1952.2 ± 0.09%' │ '1900.0 ± 100.00' │ '520616 ± 0.01%'       │ '526316 ± 26316'       │ 1024509 │
│ 3       │ 'lru-cache-ttl get' │ '2294.3 ± 0.04%' │ '2300.0 ± 100.00' │ '439807 ± 0.01%'       │ '434783 ± 18116'       │ 871728  │
│ 4       │ 'quick-lru get'     │ '1712.2 ± 0.05%' │ '1700.0 ± 100.00' │ '592920 ± 0.02%'       │ '588235 ± 32680'       │ 1168094 │
│ 5       │ 'mnemonist get'     │ '1108.6 ± 0.08%' │ '1100.0 ± 100.00' │ '920125 ± 0.01%'       │ '909091 ± 75758'       │ 1804134 │
└─────────┴─────────────────────┴──────────────────┴───────────────────┴────────────────────────┴────────────────────────┴─────────┘

📊 DELETE Operations Benchmark
==================================================
┌─────────┬────────────────────┬──────────────────┬───────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name          │ Latency avg (ns) │ Latency med (ns)  │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────┼──────────────────┼───────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'tiny-lru delete'  │ '6629.3 ± 1.50%' │ '6700.0 ± 700.00' │ '166203 ± 0.08%'       │ '149254 ± 14119'       │ 301694  │
│ 1       │ 'lru-cache delete' │ '6842.3 ± 0.56%' │ '6100.0 ± 600.00' │ '155836 ± 0.06%'       │ '163934 ± 17884'       │ 292298  │
│ 2       │ 'quick-lru delete' │ '4959.2 ± 2.25%' │ '4100.0 ± 500.00' │ '225144 ± 0.07%'       │ '243902 ± 33875'       │ 403289  │
│ 3       │ 'mnemonist delete' │ '6286.5 ± 0.85%' │ '6700.0 ± 600.00' │ '167622 ± 0.07%'       │ '149254 ± 12267'       │ 318143  │
└─────────┴────────────────────┴──────────────────┴───────────────────┴────────────────────────┴────────────────────────┴─────────┘

📊 UPDATE Operations Benchmark
==================================================
┌─────────┬────────────────────────┬──────────────────┬───────────────────┬────────────────────────┬────────────────────────┬─────────┐
│ (index) │ Task name              │ Latency avg (ns) │ Latency med (ns)  │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├─────────┼────────────────────────┼──────────────────┼───────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0       │ 'tiny-lru update'      │ '1193.2 ± 0.10%' │ '1200.0 ± 100.00' │ '852516 ± 0.01%'       │ '833333 ± 64103'       │ 1676200 │
│ 1       │ 'tiny-lru-ttl update'  │ '1195.0 ± 0.05%' │ '1200.0 ± 100.00' │ '849120 ± 0.01%'       │ '833333 ± 64103'       │ 1673670 │
│ 2       │ 'lru-cache update'     │ '2189.2 ± 0.28%' │ '2100.0 ± 100.00' │ '470797 ± 0.02%'       │ '476190 ± 21645'       │ 913573  │
│ 3       │ 'lru-cache-ttl update' │ '4721.2 ± 0.22%' │ '4600.0 ± 100.00' │ '215969 ± 0.02%'       │ '217391 ± 4831'        │ 423618  │
│ 4       │ 'quick-lru update'     │ '1903.0 ± 0.15%' │ '1900.0 ± 100.00' │ '533334 ± 0.02%'       │ '526316 ± 26316'       │ 1050990 │
│ 5       │ 'mnemonist update'     │ '1077.2 ± 0.05%' │ '1100.0 ± 0.00'   │ '940049 ± 0.01%'       │ '909091 ± 0'           │ 1856670 │
└─────────┴────────────────────────┴──────────────────┴───────────────────┴────────────────────────┴────────────────────────┴─────────┘

📊 Memory Usage Analysis
==================================================

Memory Usage Results:
┌─────────────────┬─────────────────┬─────────────────┬─────────────────┐
│ Library         │ Bundle Size     │ Memory/Item     │ Total Memory    │
├─────────────────┼─────────────────┼─────────────────┼─────────────────┤
│ tiny-lru        │ N/A             │ 243 bytes       │ 238 KB          │
│ tiny-lru-ttl    │ N/A             │ 195 bytes       │ 190 KB          │
│ lru-cache       │ N/A             │ 114 bytes       │ 111 KB          │
│ lru-cache-ttl   │ N/A             │ 162 bytes       │ 158 KB          │
│ quick-lru       │ N/A             │ 154 bytes       │ 151 KB          │
│ mnemonist       │ ~45KB           │ 136 bytes       │ 132 KB          │
└─────────────────┴─────────────────┴─────────────────┴─────────────────┘

📊 Performance Summary
==================================================

Operations per second (higher is better):
┌─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────┐
│ Library         │ SET ops/sec     │ GET ops/sec     │ UPDATE ops/sec  │ DELETE ops/sec  │
├─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤
│ tiny-lru        │ 0               │ 0               │ 0               │ 0               │
│ lru-cache       │ 0               │ 0               │ 0               │ 0               │
│ quick-lru       │ 0               │ 0               │ 0               │ 0               │
│ mnemonist       │ 0               │ 0               │ 0               │ 0               │
└─────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┘

✅ Benchmark completed!

To regenerate this data, run: npm run benchmark:comparison

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