Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created March 7, 2023 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/0d9a2a686337d7a322488348714b9429 to your computer and use it in GitHub Desktop.
Save isaacs/0d9a2a686337d7a322488348714b9429 to your computer and use it in GitHub Desktop.
> bench-lru@1.2.1 start
> NODE_ENV=production node index.js
int: just an integer
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just an obj](Object.create(null)) | 25000 | 33333 | 25000 | 33333 | 25000 | 466664 |
| [just a {}]({}) | 25000 | 33333 | 25000 | 33333 | 25000 | 466664 |
| [hashlru](https://npmjs.com/package/hashlru) | 25000 | 25000 | 16667 | 25000 | 25000 | 391667 |
| [just a Map](new Map()) | 16667 | 25000 | 16667 | 25000 | 16667 | 333336 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 7143 | 33333 | 20000 | 25000 | 10000 | 309285 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 12500 | 20000 | 16667 | 20000 | 11111 | 257222 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 12500 | 20000 | 16667 | 20000 | 10000 | 251667 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 14286 | 16667 | 16667 | 16667 | 11111 | 234130 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 4348 | 20000 | 5263 | 20000 | 5556 | 201739 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 3226 | 20000 | 5556 | 20000 | 4167 | 192843 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 5263 | 16667 | 10000 | 16667 | 7692 | 192322 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 4167 | 14286 | 5000 | 20000 | 3704 | 174712 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 11111 | 10000 | 8333 | 10000 | 12500 | 173055 |
strint: stringified integer
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just an obj](Object.create(null)) | 25000 | 33333 | 25000 | 33333 | 25000 | 466664 |
| [just a {}]({}) | 25000 | 33333 | 25000 | 33333 | 25000 | 466664 |
| [just a Map](new Map()) | 20000 | 33333 | 25000 | 33333 | 20000 | 431664 |
| [hashlru](https://npmjs.com/package/hashlru) | 20000 | 25000 | 20000 | 25000 | 20000 | 360000 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 14286 | 20000 | 25000 | 25000 | 14286 | 310002 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 6667 | 33333 | 20000 | 25000 | 8333 | 299998 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 16667 | 14286 | 20000 | 25000 | 14286 | 292622 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 16667 | 16667 | 20000 | 20000 | 14286 | 274765 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 4762 | 25000 | 4348 | 25000 | 5556 | 241652 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 3333 | 25000 | 4000 | 25000 | 5000 | 235666 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 5556 | 16667 | 11111 | 20000 | 9091 | 217679 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 4545 | 25000 | 5263 | 11111 | 4545 | 167633 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 11111 | 10000 | 7692 | 10000 | 11111 | 165469 |
str: string that is not a number
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just a Map](new Map()) | 16667 | 25000 | 20000 | 25000 | 16667 | 336669 |
| [just an obj](Object.create(null)) | 16667 | 25000 | 25000 | 25000 | 14286 | 329764 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 10000 | 25000 | 20000 | 25000 | 8333 | 281665 |
| [just a {}]({}) | 12500 | 20000 | 16667 | 20000 | 12500 | 264167 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 11111 | 20000 | 16667 | 20000 | 9091 | 244344 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 11111 | 20000 | 16667 | 20000 | 9091 | 244344 |
| [hashlru](https://npmjs.com/package/hashlru) | 14286 | 14286 | 14286 | 14286 | 14286 | 228576 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 11111 | 16667 | 16667 | 16667 | 8333 | 213890 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 4000 | 20000 | 5263 | 20000 | 3571 | 191118 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 8333 | 14286 | 10000 | 16667 | 6667 | 186194 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 3846 | 16667 | 5263 | 16667 | 3448 | 163531 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 4762 | 16667 | 5556 | 16667 | 2941 | 163121 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 10000 | 9091 | 8333 | 9091 | 6667 | 134396 |
numstr: a mix of integers and strings that look like them
just an obj failed correctness check at key="2"
just a {} failed correctness check at key="2"
hashlru failed correctness check at key="2"
lru-fast failed correctness check at key="2"
mnemonist-object failed correctness check at key="2"
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just a Map](new Map()) | 14286 | 25000 | 16667 | 25000 | 16667 | 328574 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 12500 | 20000 | 16667 | 20000 | 11111 | 257222 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 12500 | 20000 | 16667 | 20000 | 10000 | 251667 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 4000 | 20000 | 5000 | 20000 | 3704 | 191520 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 8333 | 14286 | 5263 | 16667 | 7143 | 183837 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 11111 | 12500 | 14286 | 12500 | 9091 | 181963 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 4167 | 12500 | 5263 | 20000 | 5556 | 178877 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 4762 | 16667 | 4545 | 16667 | 4348 | 169145 |
| [just an obj](Object.create(null)) | 0 | 0 | 0 | 0 | 0 | 0 |
| [just a {}]({}) | 0 | 0 | 0 | 0 | 0 | 0 |
| [hashlru](https://npmjs.com/package/hashlru) | 0 | 0 | 0 | 0 | 0 | 0 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 0 | 0 | 0 | 0 | 0 | 0 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 0 | 0 | 0 | 0 | 0 | 0 |
pi: multiples of pi
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just a Map](new Map()) | 16667 | 25000 | 20000 | 25000 | 16667 | 336669 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 12500 | 16667 | 16667 | 16667 | 8333 | 216668 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 12500 | 16667 | 16667 | 16667 | 8333 | 216668 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 7692 | 14286 | 16667 | 14286 | 8333 | 188004 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 7692 | 14286 | 9091 | 14286 | 5882 | 168173 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 4762 | 16667 | 5556 | 16667 | 3571 | 166271 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 4000 | 16667 | 5263 | 16667 | 3448 | 163839 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 4167 | 16667 | 5263 | 14286 | 4762 | 158838 |
| [just an obj](Object.create(null)) | 3448 | 5882 | 4762 | 5882 | 4348 | 80454 |
| [just a {}]({}) | 2941 | 5882 | 4762 | 5882 | 3704 | 76220 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 2778 | 5263 | 5000 | 5556 | 1587 | 62060 |
| [hashlru](https://npmjs.com/package/hashlru) | 3226 | 3704 | 3704 | 3571 | 4167 | 59958 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 3030 | 3846 | 3704 | 3846 | 1818 | 49622 |
float: floating point values
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just a Map](new Map()) | 14286 | 20000 | 16667 | 20000 | 14286 | 276669 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 11111 | 16667 | 14286 | 16667 | 7692 | 208304 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 9091 | 14286 | 12500 | 16667 | 7692 | 195335 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 7143 | 14286 | 16667 | 14286 | 8333 | 186906 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 5000 | 16667 | 5000 | 16667 | 3448 | 165576 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 4000 | 16667 | 5000 | 16667 | 3448 | 163576 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 7692 | 12500 | 9091 | 14286 | 5882 | 162815 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 4762 | 16667 | 4000 | 14286 | 4348 | 156695 |
| [just an obj](Object.create(null)) | 3448 | 5882 | 4762 | 5882 | 4348 | 80454 |
| [just a {}]({}) | 3030 | 5882 | 4762 | 5882 | 3704 | 76398 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 2857 | 5556 | 5263 | 5556 | 1695 | 63900 |
| [hashlru](https://npmjs.com/package/hashlru) | 3226 | 3571 | 3571 | 3571 | 4167 | 59426 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 2500 | 3846 | 3571 | 3704 | 1563 | 46444 |
obj: an object with a single key
just an obj failed correctness check at key={"z":0}
just a {} failed correctness check at key={"z":0}
hashlru failed correctness check at key={"z":0}
lru-fast failed correctness check at key={"z":0}
mnemonist-object failed correctness check at key={"z":0}
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just a Map](new Map()) | 16667 | 25000 | 20000 | 25000 | 16667 | 336669 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 14286 | 20000 | 20000 | 20000 | 11111 | 264127 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 10000 | 20000 | 20000 | 20000 | 11111 | 255555 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 14286 | 14286 | 20000 | 16667 | 11111 | 230320 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 4348 | 20000 | 14286 | 16667 | 9091 | 211772 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 4167 | 20000 | 4545 | 20000 | 3846 | 192109 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 5263 | 14286 | 11111 | 16667 | 7692 | 186290 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 4000 | 14286 | 5556 | 20000 | 5556 | 184194 |
| [just an obj](Object.create(null)) | 0 | 0 | 0 | 0 | 0 | 0 |
| [just a {}]({}) | 0 | 0 | 0 | 0 | 0 | 0 |
| [hashlru](https://npmjs.com/package/hashlru) | 0 | 0 | 0 | 0 | 0 | 0 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 0 | 0 | 0 | 0 | 0 | 0 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 0 | 0 | 0 | 0 | 0 | 0 |
rand: random floating point number
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just a Map](new Map()) | 16667 | 25000 | 20000 | 25000 | 16667 | 336669 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 12500 | 20000 | 14286 | 16667 | 8333 | 224286 |
| [just an obj](Object.create(null)) | 7143 | 20000 | 11111 | 20000 | 6667 | 218732 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 12500 | 16667 | 16667 | 16667 | 7692 | 213463 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 12500 | 14286 | 12500 | 14286 | 8333 | 193453 |
| [just a {}]({}) | 5556 | 16667 | 10000 | 16667 | 5556 | 182228 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 4545 | 16667 | 16667 | 16667 | 3333 | 175758 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 5882 | 14286 | 10000 | 14286 | 5882 | 165462 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 4167 | 16667 | 6250 | 16667 | 3448 | 165160 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 4167 | 16667 | 5000 | 16667 | 3333 | 163335 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 3226 | 16667 | 5556 | 16667 | 2857 | 159629 |
| [hashlru](https://npmjs.com/package/hashlru) | 6250 | 6667 | 6667 | 6667 | 6250 | 103753 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 4000 | 7692 | 7143 | 7692 | 3333 | 93344 |
sym: a Symbol object
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just a Map](new Map()) | 16667 | 25000 | 20000 | 25000 | 16667 | 336669 |
| [just an obj](Object.create(null)) | 16667 | 25000 | 25000 | 25000 | 14286 | 329764 |
| [just a {}]({}) | 14286 | 25000 | 20000 | 25000 | 14286 | 320002 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 10000 | 25000 | 20000 | 25000 | 4762 | 263810 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 14286 | 20000 | 16667 | 20000 | 10000 | 255239 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 14286 | 16667 | 16667 | 16667 | 10000 | 228575 |
| [hashlru](https://npmjs.com/package/hashlru) | 14286 | 16667 | 14286 | 14286 | 12500 | 226789 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 14286 | 10000 | 16667 | 20000 | 10000 | 225239 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 5000 | 20000 | 5882 | 20000 | 5000 | 200882 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 4167 | 20000 | 5556 | 20000 | 5263 | 200205 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 4000 | 20000 | 5263 | 20000 | 3571 | 191118 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 6667 | 14286 | 10000 | 16667 | 7143 | 185242 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 9091 | 9091 | 8333 | 9091 | 6667 | 132578 |
longstr: a very long string
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just an obj](Object.create(null)) | 12500 | 25000 | 20000 | 25000 | 12500 | 307500 |
| [just a {}]({}) | 12500 | 25000 | 20000 | 25000 | 12500 | 307500 |
| [just a Map](new Map()) | 14286 | 20000 | 16667 | 20000 | 14286 | 276669 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 7692 | 25000 | 20000 | 20000 | 7143 | 246099 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 10000 | 16667 | 14286 | 16667 | 7692 | 206082 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 11111 | 16667 | 16667 | 14286 | 8333 | 201985 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 10000 | 16667 | 14286 | 14286 | 8333 | 197382 |
| [hashlru](https://npmjs.com/package/hashlru) | 12500 | 12500 | 11111 | 11111 | 10000 | 179166 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 7692 | 16667 | 7143 | 16667 | 4545 | 178588 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 3704 | 16667 | 4762 | 16667 | 3448 | 162746 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 9091 | 9091 | 8333 | 9091 | 9091 | 144698 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 2632 | 14286 | 3333 | 14286 | 2564 | 135705 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 7143 | 10000 | 10000 | 8333 | 6250 | 127201 |
mix: a mix of all the types
just an obj failed correctness check at key={"z":3}
just a {} failed correctness check at key={"z":3}
hashlru failed correctness check at key={"z":3}
lru-fast failed correctness check at key={"z":3}
mnemonist-object failed correctness check at key={"z":3}
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just a Map](new Map()) | 12500 | 20000 | 16667 | 20000 | 14286 | 273097 |
| [lru-cache-7-dispose-after](https://npmjs.com/package/lru-cache) | 10000 | 16667 | 14286 | 16667 | 8333 | 209287 |
| [lru-cache-7](https://npmjs.com/package/lru-cache) | 9091 | 16667 | 14286 | 16667 | 8333 | 207469 |
| [mnemonist-map](https://www.npmjs.com/package/mnemonist) | 11111 | 14286 | 16667 | 14286 | 7692 | 191637 |
| [lru-cache-8](https://github.com/isaacs/node-lru-cache/pull/280) | 4348 | 14286 | 12500 | 14286 | 7692 | 173944 |
| [lru-cache-7-dispose](https://npmjs.com/package/lru-cache) | 3704 | 16667 | 7143 | 16667 | 4762 | 171697 |
| [lru-cache-7-size](https://npmjs.com/package/lru-cache) | 3704 | 16667 | 4762 | 14286 | 3448 | 150841 |
| [lru-cache-7-ttl](https://npmjs.com/package/lru-cache) | 7143 | 6667 | 9091 | 14286 | 6250 | 146058 |
| [just an obj](Object.create(null)) | 0 | 0 | 0 | 0 | 0 | 0 |
| [just a {}]({}) | 0 | 0 | 0 | 0 | 0 | 0 |
| [hashlru](https://npmjs.com/package/hashlru) | 0 | 0 | 0 | 0 | 0 | 0 |
| [lru-fast](https://npmjs.com/package/lru-fast) | 0 | 0 | 0 | 0 | 0 | 0 |
| [mnemonist-object](https://www.npmjs.com/package/mnemonist) | 0 | 0 | 0 | 0 | 0 | 0 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment