bench-cache

0.1.2 • Public • Published

Benchmark the difference caches

npm test
 
 
┌───────────────────────┬───────┬────────┬───────┬───────┬───────┐
│ Heap Total(MB)        │ add   │ update │ get   │ del   │ clear │
├───────────────────────┼───────┼────────┼───────┼───────┼───────┤
│ Fixed Cache(seconday) │ 0.000 │ 0.000  │ 0.000 │ 0.000 │ 0.000 │
├───────────────────────┼───────┼────────┼───────┼───────┼───────┤
│ LRU Cache(seconday)   │ 8.000 │ 0.000  │ 0.000 │ 0.000 │ 0.000 │
├───────────────────────┼───────┼────────┼───────┼───────┼───────┤
│ lru-cache             │ 3.968 │ 0.000  │ 4.984 │ 0.984 │ 0.000 │
├───────────────────────┼───────┼────────┼───────┼───────┼───────┤
│ simple-lru-cache      │ 0.000 │ 0.000  │ 0.000 │ 0.000 │ 0.000 │
└───────────────────────┴───────┴────────┴───────┴───────┴───────┘
┌───────────────────────┬────────┬────────┬───────┬────────┬───────┐
│ Heap Used(MB)         │ add    │ update │ get   │ del    │ clear │
├───────────────────────┼────────┼────────┼───────┼────────┼───────┤
│ Fixed Cache(seconday) │ 0.446  │ 1.221  │ 0.308 │ 1.749  │ 0.002 │
├───────────────────────┼────────┼────────┼───────┼────────┼───────┤
│ LRU Cache(seconday)   │ 0.613  │ 1.528  │ 0.886 │ -4.104 │ 0.000 │
├───────────────────────┼────────┼────────┼───────┼────────┼───────┤
│ lru-cache             │ 1.988  │ 0.796  │ 0.009 │ 1.677  │ 0.002 │
├───────────────────────┼────────┼────────┼───────┼────────┼───────┤
│ simple-lru-cache      │ -3.761 │ 0.760  │ 0.328 │ 0.692  │ 0.001 │
└───────────────────────┴────────┴────────┴───────┴────────┴───────┘
┌───────────────────────┬───────┬────────┬───────┬───────┬───────┐
│ Memory Used(MB)       │ add   │ update │ get   │ del   │ clear │
├───────────────────────┼───────┼────────┼───────┼───────┼───────┤
│ Fixed Cache(seconday) │ 1.465 │ 0.000  │ 0.051 │ 0.285 │ 0.004 │
├───────────────────────┼───────┼────────┼───────┼───────┼───────┤
│ LRU Cache(seconday)   │ 1.297 │ 1.195  │ 0.879 │ 1.852 │ 0.000 │
├───────────────────────┼───────┼────────┼───────┼───────┼───────┤
│ lru-cache             │ 3.641 │ 0.305  │ 0.855 │ 1.281 │ 0.004 │
├───────────────────────┼───────┼────────┼───────┼───────┼───────┤
│ simple-lru-cache      │ 3.074 │ 0.020  │ 0.008 │ 0.008 │ 0.000 │
└───────────────────────┴───────┴────────┴───────┴───────┴───────┘
┌───────────────────────┬────────┬────────┬────────┬────────┬───────┐
│ Time Cost(ms)         │ add    │ update │ get    │ del    │ clear │
├───────────────────────┼────────┼────────┼────────┼────────┼───────┤
│ Fixed Cache(seconday) │ 14.007 │ 5.982  │ 2.784  │ 11.420 │ 0.116 │
├───────────────────────┼────────┼────────┼────────┼────────┼───────┤
│ LRU Cache(seconday)   │ 20.426 │ 13.729 │ 11.332 │ 28.606 │ 0.035 │
├───────────────────────┼────────┼────────┼────────┼────────┼───────┤
│ lru-cache             │ 23.985 │ 15.621 │ 15.752 │ 15.438 │ 0.125 │
├───────────────────────┼────────┼────────┼────────┼────────┼───────┤
│ simple-lru-cache      │ 27.225 │ 6.281  │ 4.886  │ 7.287  │ 0.030 │
└───────────────────────┴────────┴────────┴────────┴────────┴───────┘

Package Sidebar

Install

npm i bench-cache

Weekly Downloads

4

Version

0.1.2

License

MIT

Last publish

Collaborators

  • riceball