News for hackers. Stuff that matters.
Re:UUIDs are popular, but bad for performance (2019) by mhoad on Saturday January 08, 2022 @10:56AM (#29852828)
I recently read a book by Google’s head guy on API design that was specifically about designing APIs and it had a big section on what makes a good identifier and why people reach for UUIDs and why specifically it is a problem on multiple levels.

The thing that he ended up recommending however was super interesting in that I had never seen it mentioned before but it was basically to use this instead http://www.crockford.com/base32.html

Re:UUIDs are popular, but bad for performance (2019) by Nav_Panel on Saturday January 08, 2022 @11:05AM (#29852914)
I see this around the crypto world a lot lately (notably for Substrate/Polkadot addresses): base58 https://tools.ietf.org/id/draft-msporny-base58-01.html

Seems to have the same idea of "human-read-write without visually identical characters" but with an expanded set for shorter string length.

Re:UUIDs are popular, but bad for performance (2019) by pkulak on Saturday January 08, 2022 @11:36AM (#29853271)
I use crockford 32 to _represent_ my UUIDs, but they are obviously stored as binary. Is the only problem with UUIDs that sometimes they get stored as strings?

The only issue I've had with UUIDs is when they don't sort in increasing chronological order. RDBMSs don't appreciate high insert loads into random points in the index. Take care of that, however, and they're a treat.

Re:UUIDs are popular, but bad for performance (2019) by paulryanrogers on Saturday January 08, 2022 @11:44AM (#29853357)
ULIDs or time prefixed UUIDs are other options.
Re:UUIDs are popular, but bad for performance (2019) by staticassertion on Saturday January 08, 2022 @12:26PM (#29853831)
The linked article discusses the issues - the storage size when encoded as char, as 16byte values, as well as the impact on read/write locality.
Re:UUIDs are popular, but bad for performance (2019) by dpark on Saturday January 08, 2022 @02:48PM (#29855434)
Where does it discuss any of this? It compares base 10/16/32/64. There’s no mention at all of UUIDs or GUIDs.

(Or do you mean the original article, rather than the linked Crockford article?)

Re:UUIDs are popular, but bad for performance (2019) by staticassertion on Saturday January 08, 2022 @03:54PM (#29856129)
I mean the original.
Re:UUIDs are popular, but bad for performance (2019) by mhoad on Saturday January 08, 2022 @11:41AM (#29853324)
Yeah I seem to recall he also mentioned that as an approach.
Re:UUIDs are popular, but bad for performance (2019) by carfacts on Saturday January 08, 2022 @11:09AM (#29852962)
This format was discussed in a HN first page post just this week:

> This alphabet, 0123456789ABCDEFGHJKMNPQRSTVWXYZ, is Douglas Crockford's Base32, chosen for human readability and being able to call it out over a phone if required.

https://news.ycombinator.com/item?id=29794186

Re:UUIDs are popular, but bad for performance (2019) by davidjytang on Saturday January 08, 2022 @11:27AM (#29853174)
People in my industry in my country has specifically avoid using B and D together as they sound too similar over the phone.

Also 2 and Z can be similar in writing.

However it is nice to not see 0 and O, 1,I,l in the same string.

Re:UUIDs are popular, but bad for performance (2019) by FabHK on Saturday January 08, 2022 @11:56AM (#29853488)
F and S sound similar over the phone, at least on POTS landlines, as they don't carry the higher frequencies (> 4 kHz) that distinguish the S from the F. Note that cat names tend to have S sounds.

POTS = Plain old telephony service is restricted to a narrow frequency range of 300–3,300 Hz, called the voiceband, which is much less than the human hearing range of 20–20,000 Hz [from https://en.wikipedia.org/wiki/Plain_old_telephone_service ]

Re:UUIDs are popular, but bad for performance (2019) by jandrese on Saturday January 08, 2022 @01:56PM (#29854879)
Anybody who has to relay things like API or CD keys over a POTS line on a regular basis quickly learns the NATO phonetic alphabet.
Re:UUIDs are popular, but bad for performance (2019) by et-al on Saturday January 08, 2022 @01:03PM (#29854284)
If you're worried about clarity over the phone, you should look into the NATO phonetic alphabet: https://en.wikipedia.org/wiki/NATO_phonetic_alphabet
Re:UUIDs are popular, but bad for performance (2019) by cperciva on Saturday January 08, 2022 @03:23PM (#29855778)
I prefer to use Aeon, Bdellium, Czar, Djinn, Eye, etc.
Re:UUIDs are popular, but bad for performance (2019) by slavik81 on Saturday January 08, 2022 @06:22PM (#29857713)
The bomb defusal scene in Archer was an absolute classic for this. https://youtu.be/_4jxLxZrMfs
Re:UUIDs are popular, but bad for performance (2019) by oldsecondhand on Saturday January 08, 2022 @04:11PM (#29856335)
> Djinn

Fun fact: dzs counts as a single letter in Hungarian (e.g. in alphabetical ordering).

Re:UUIDs are popular, but bad for performance (2019) by davidjytang on Sunday January 09, 2022 @02:44AM (#29861194)
Quite a challenge for non-English crowd.
Re:UUIDs are popular, but bad for performance (2019) by layer8 on Saturday January 08, 2022 @02:16PM (#29855087)
You still have to know that 0 is 0 and not O, and that 1 is 1 and not I or l.
Re:UUIDs are popular, but bad for performance (2019) by tapas73 on Saturday January 08, 2022 @03:01PM (#29855555)
but if mistake is made, and you wrote down L instead of 1, and sent me in a e-mail. I, knowing that it is crockford 32, would easily deduce what mistake was made.
Re:UUIDs are popular, but bad for performance (2019) by layer8 on Saturday January 08, 2022 @06:37PM (#29857854)
Right, I didn't realize the decoder is specified to be lenient in that way, so the confounded characters are actually equivalent in the encoding.
Re:UUIDs are popular, but bad for performance (2019) by mhoad on Saturday January 08, 2022 @11:12AM (#29852990)
Yeah when he lays out the arguments for it in the book you can clearly see why it makes a huge amount of sense. The usability, the performance, the value of a checksum etc…
Re:UUIDs are popular, but bad for performance (2019) by Zamicol on Saturday January 08, 2022 @03:47PM (#29856030)
Looking for that quote I can't find it on that page.
Re:UUIDs are popular, but bad for performance (2019) by lelandbatey on Saturday January 08, 2022 @03:52PM (#29856086)
I'm a big fan of Crockford-flavored Base32, as in $dayjob the folks who did some of the fundamental engineering work for the product I work with decided 10+ years ago to use Crockfor-flavored Base32 as the way to expose most user-visible IDs. Things I love about it are all mentioned in Crockford's spec, but I'll restate them here:

- It's case-insensitive allowing data encoded with it to survive going through most random line-of-business applications which may have errant UPPER() or lower() calls somewhere in their depths, as well as making it easy for humans to talk about out-loud (no need to specify case makes it easy)

- Making all the "pillar" shaped characters (I, i, 1, l) equivalent and all the "donut" shaped characters (o, O, 0) equivalent means big swaths of human typing mistakes are avoided. After so much exposure to Crockford Base32, I now loath having to decipher "is it a capitol 'I'? Or a lowercase 'l'?"

Overall, it's a great way to encode any user-facing ID; just make sure you understand that just using this encoding won't stop users from realizing that Crockford Base32 encoded IDs are sequential. If you want sequential IDs to appear non-obviously sequential after encoding you'll need to use additional techniques. Assuming Crockford Base32 obscures sequential IDs is the one case where I saw someone do something they shouldn't as it directly relates to Crockford Base32.

Re:UUIDs are popular, but bad for performance (2019) by fivea on Saturday January 08, 2022 @11:52AM (#29853446)
> (...) but it was basically to use this instead

Base32 is a representation format which provides a textual representation of numbers, not a storage format.

I mean, anyone is free to dump Base32, or even base 2, into a string and just run with that, but that would be highly inefficient.

Re:UUIDs are popular, but bad for performance (2019) by Zamicol on Saturday January 08, 2022 @03:35PM (#29855904)
Oh wow thanks! I was familiar with Zimmerman's base 32, (z-base-32, https://philzimmermann.com/docs/human-oriented-base-32-encod...) but not Crockford's.

I just added it to the "Other projects" section of my base converter. https://convert.zamicol.com/

Re:UUIDs are popular, but bad for performance (2019) by hermanradtke on Saturday January 08, 2022 @11:26AM (#29853153)
ULIDs are base 32 as well. https://github.com/oklog/ulid
Re:UUIDs are popular, but bad for performance (2019) by gnabgib on Saturday January 08, 2022 @02:29PM (#29855225)
Is the spec not a better link than a go implementation?

https://github.com/ulid/spec

Re:UUIDs are popular, but bad for performance (2019) by nostrebored on Saturday January 08, 2022 @11:03AM (#29852895)
What was the book?
Re:UUIDs are popular, but bad for performance (2019) by mhoad on Saturday January 08, 2022 @11:09AM (#29852965)
https://www.bookdepository.com/API-Design-Patterns-JJ-Geewax...

I loved it, think it all made a ton of sense. Lots of code samples, no weird technology choices (normally they would do it all via protobufs and gRPC but they keep the same principles and just use HTTP instead and Typescript for code samples)

Re:UUIDs are popular, but bad for performance (2019) by jgeewax on Sunday January 09, 2022 @07:20PM (#29868994)
Glad to hear ! :-)
Re:UUIDs are popular, but bad for performance (2019) by afhammad on Saturday January 08, 2022 @11:12AM (#29852998)
https://livebook.manning.com/book/api-design-patterns/chapte...

Section 6.3.3 gets to the point about base32

Re:UUIDs are popular, but bad for performance (2019) by rco8786 on Saturday January 08, 2022 @02:35PM (#29855291)
We use crockford tokens heavily where I work, highly recommend them. We typically use a prefix to denote the type of thing being identified, like “U-“ for User followed by a 10-15ish long crockford token. Works great.
Re:UUIDs are popular, but bad for performance (2019) by wbl on Saturday January 08, 2022 @11:38AM (#29853298)
Would you happen to have a link to the book?
Re:UUIDs are popular, but bad for performance (2019) by relueeuler on Saturday January 08, 2022 @04:05PM (#29856246)
Re:UUIDs are popular, but bad for performance (2019) by pottertheotter on Saturday January 08, 2022 @03:01PM (#29855554)
Re:UUIDs are popular, but bad for performance (2019) by mattacular on Saturday January 08, 2022 @01:30PM (#29854586)
Which book?
Re:UUIDs are popular, but bad for performance (2019) by pottertheotter on Saturday January 08, 2022 @03:00PM (#29855552)