// the find
mcollina/hyperid
Uber-fast unique id generation, for Node.js and the browser
hyperid generates unique IDs by combining a UUID with an incrementing counter, encoded in base64. It's faster than crypto.randomUUID and uuid.v4 because it avoids repeated entropy calls — the UUID regenerates only every 2^31 iterations. Useful when you need high-throughput ID generation in request handlers, loggers, or message queues.
The benchmark numbers are honest — 62M ops/sec is real and the mechanism (UUID + counter, not pure random) explains why. The decode function is a nice touch; you can extract the UUID and counter from any generated ID, which is useful for debugging or tracing. Browser support via a separate uuid-browser.js module, URL-safe mode for IDs that go into URLs without encoding, and TypeScript types all ship in the box. The maxInt option exploiting V8 SMI optimization is a clever micro-optimization that actually shows up in the benchmark.
The IDs are not sortable by time — if you need that, use ULIDs or UUIDv7. The uniqueness guarantee depends on the UUID cycling correctly across instances: if you have multiple processes generating IDs with the same in-flight UUID (e.g., at startup), collisions are possible, and there is no coordination mechanism. The counter is process-local, so the 'uniqueness' story in a distributed system is weaker than the README implies. 749 stars for a repo by @mcollina (Fastify core maintainer) suggests the Node.js ecosystem largely moved to crypto.randomUUID and is fine with the ~35M ops/sec tradeoff.