Fastest unique id generator.
pnpm i kgid
import { kgid } from 'kgid';
console.log(kgid());
β benchmark> node index.mjs
βββββββββββ¬βββββββββββββββ¬ββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β (index) β Task Name β Average Time (ps) β Variance (ps) β
βββββββββββΌβββββββββββββββΌββββββββββββββββββββββΌββββββββββββββββββββββββ€
β 0 β 'nanoid' β 0.21404910435571142 β 0.0010931945194185824 β
β 1 β 'kgid' β 0.08688025856545194 β 0.0002604025737242756 β
β 2 β 'react-uuid' β 0.7893323068767657 β 0.02007272352994441 β
βββββββββββ΄βββββββββββββββ΄ββββββββββββββββββββββ΄ββββββββββββββββββββββββ
kgid x 26,559,754 ops/sec Β±0.31% (97 runs sampled)
react-uuid x 1,408,511 ops/sec Β±0.18% (98 runs sampled)
nanoid() x 6,048,306 ops/sec Β±0.69% (95 runs sampled)
Fastest is kgid
β benchmark> node unique-test.mjs
1000000 times kgid: All generated ids are unique
1000000 times nanoid: All generated ids are unique
1000000 times react-uuid: All generated ids are unique