this post was submitted on 24 Nov 2025
357 points (99.2% liked)

Programmer Humor

27490 readers
1557 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] ChaoticNeutralCzech@feddit.org 5 points 23 hours ago (1 children)

That would indeed be way (quadratically) more likely but we don't count the number of attempts but measure run time, and since comparisons (even with optimizations like insertion sort) take time, the speed difference between the two methods will be "just" a few orders of magnitude.

[โ€“] Redjard@lemmy.dbzer0.com 3 points 22 hours ago

As long as you don't run out of memory, you can actually insert and lookup in O(1) time for a known space of values (that we have). Therefore we do get the quadratic speedup, that when dealing with bits of keysize or entropy means cutting it in half.
Checking to get a specific uuid takes 128bit, so 2^128^ draws of a uuid. Putting all previous uuids into a table we expect a collision in 64bit, so 2^64^. We also need about that much storage to contain the table, so some tens of exabytes.