Skip to content

Switched to NanoID from UUID.

Christopher Case requested to merge nanoid into master

We are now using nanoid for generating our identifiers.

Benefits over UUID

(taken from here)

Nano ID is quite comparable to UUID v4 (random-based). It has a similar number of random bits in the ID (126 in Nano ID and 122 in UUID), so it has a similar collision probability:

For there to be a one in a billion chance of duplication, 103 trillion version 4 IDs must be generated.

There are three main differences between Nano ID and UUID v4:

  1. Nano ID uses a bigger alphabet, so a similar number of random bits are packed in just 21 symbols instead of 36.
  2. Nano ID code is 4.5 times less than uuid/v4 package: 108 bytes instead of 483.
  3. Because of memory allocation tricks, Nano ID is 60% faster than UUID.

Merge request reports