The post dismisses UUIDs because their default formatting uses hyphens and hex encoding (base16), but as other comments mention you can get UUIDs to be much shorter by encoding them in a different base. If you want to guarantee URL-safety and selection via double-click, use base62 (26 lower-case, 26 upper-case, 10 digits).
This format also lets you attach a prefix with '_' so you can keep track of the semantic type of each ID. This pattern is widely used by the Stripe API, and I've grown quite fond of it (so much easier to grep).
Additionally, within an in-memory value or a database, you probably want to store the decoded form of any ID. The value "deploy_60hNvkHrZykznfLaESuDBp" is 29 bytes long, but could be represented by `type DeployID byte[16]` for ~50% space savings and stronger type validation.
You can also base62-encode the UUID's underlying integer and you get a short, URL-friendly identifier, while maintaining the power and uniformity of UUID. The claim with nanoID is that it's twice as fast as UUID, but I'm not sure how impactful that is given my services all spent orders of magnitude more time in I/O wait for a database after any UUID functionality.
By definition, if you base62 or base64 your uuid4 it will be longer (30%?).
This generate directly in the final encoding so it is a lot shorter.
Based on the simulator calculation, you just need 24 chars to be equivalent to an uuid4 that is 35 chars.
But being able to determine the length of the resulting id is one of the greatest feature. Did it never happened to you the case that you would like a shorter uuid4 and think that you can just truncate it? Not realizing that some parts of the uuid have a special meaning and are not random...
[+] [-] jmillikin|4 years ago|reply
[+] [-] unknown|4 years ago|reply
[deleted]
[+] [-] HippoBaro|4 years ago|reply
Can’t you just… remove the hyphens? UUIDs are just arrays of bytes, the hyphens are not part of the data.
Instead, they use a less popular, less supported, more collision-prone ID format.
[+] [-] jamesboehmer|4 years ago|reply
[+] [-] greatgib|4 years ago|reply
See that: https://blog.bitsrc.io/why-is-nanoid-replacing-uuid-1b5100e6...
By definition, if you base62 or base64 your uuid4 it will be longer (30%?).
This generate directly in the final encoding so it is a lot shorter. Based on the simulator calculation, you just need 24 chars to be equivalent to an uuid4 that is 35 chars.
But being able to determine the length of the resulting id is one of the greatest feature. Did it never happened to you the case that you would like a shorter uuid4 and think that you can just truncate it? Not realizing that some parts of the uuid have a special meaning and are not random...
[+] [-] maxekman|4 years ago|reply
Notion seems to use UUIDs without hyphens in their links, and it works just fine.
[+] [-] atonse|4 years ago|reply
It works like a charm. Length decided by setting number of random bytes.