[READ-ONLY] Mirror of https://github.com/danielroe/fnv1a-64. Tiny, fast, dependency-free 64-bit FNV-1a string hash for Node and the browser.
64-bit fnv fnv-1a fnv1a hash non-cryptographic
0

Configure Feed

Select the types of activity you want to include in your feed.

fnv1a-64 / bench.mjs
998 B 25 lines
1import sindresorhusFnv1a from '@sindresorhus/fnv1a' 2import fnvLite from 'fnv-lite' 3import fnvPlus from 'fnv-plus' 4import { bench, group, run } from 'mitata' 5import murmurhash from 'murmurhash' 6import xxhash from 'xxhashjs' 7import { fnv1a64, fnv1a64Base36, fnv1a64Hex } from './src/index.ts' 8 9const short = 'user:12345:profile' 10const long = 'a'.repeat(1024) 11 12for (const [label, input] of [['short key', short], ['1KB string', long]]) { 13 void group(label, () => { 14 bench('fnv1a-64 (lanes)', () => fnv1a64(input)) 15 bench('fnv1a-64 (hex)', () => fnv1a64Hex(input)) 16 bench('fnv1a-64 (base36)', () => fnv1a64Base36(input)) 17 bench('@sindresorhus/fnv1a size:64', () => sindresorhusFnv1a(input, { size: 64 })) 18 bench('fnv-plus fast1a64 (64-bit)', () => fnvPlus.fast1a64(input)) 19 bench('fnv-lite hex (128-bit)', () => fnvLite.hex(input)) 20 bench('xxhashjs h64', () => xxhash.h64(input, 0).toString(16)) 21 bench('murmurhash v3 (32-bit)', () => murmurhash.v3(input)) 22 }) 23} 24 25await run()