Node LRU cache: the Map trick is 25x slower than lru-cache

The popular Map delete-and-set LRU trick ran at 0.59 million operations per second against 14.9 million for lru-cache 11.5.3 with 10,000 keys, and eviction cost grew from 0.14 to 24.5 microseconds as

A 25-line Map plus doubly linked list matched lru-cache at about 15 million operations per second, so a plain bounded cache does not need a dependency.

quick-lru's 71.2 percent hit rate beat lru-cache's 68.3 percent only because it held 15,288 entries at maxSize 10,000; at 15,000 entries lru-cache reached 72.2 percent.

Read the full post

Read the full post