I built a unique ID generator that's ~60% faster than nanoid
jet-id is a tiny, zero-dependency unique ID generator for JavaScript and TypeScript. IDs are 28-character Crockford base32 strings, with optional timestamps so they sort by creation time. import jetId from ' jet-id ' ; jetId (); // '9Q8SWWBTY-7NVXM-FT9S6-XB4R3M' jetId . timed (); // '1KKNTQ2CN-606ZG-8VF48-76B6F3' (sorts by creation time) seanpmaxwell / jet-id An extremely fast unique ID generator…
jet-id is a fast, zero-dependency unique ID generator for JavaScript and TypeScript. It produces 28-character Crockford base32 strings with optional timestamps to keep IDs sortable by creation time. The library is ~60% faster than nanoid, generating ~83 million IDs per second compared to nanoid's ~52 million on the same machine. jet-id uses the Crockford alphabet, which excludes confusing characters like I, L, O, and U. It offers readable IDs, zero runtime dependencies, a small size of 6.4 kB when packed, and works in Node.js and modern browsers.
The generator operates by pooling, using 256 IDs at a time, and employing lookup tables and bit-shifting for efficiency. Benchmarks show jet-id is faster than nanoid, even when configured to match nanoid's dash-separated format.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.