Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
I see UUID.randomUUID() used all over Phoenix a lot.
randomUUID uses SecureRandom internally, which - on my machine - takes almost 3ms, and that is per UUID!
I don't think we need a UUIDs from a cryptographically sound random number generator.
We could do new UUID(random.nextLong(), random.nextLong()), which takes 0.06ms (60us), or even better: new UUID(ThreadLocalRandom.current().nextLong(), ThreadLocalRandom.current().nextLong()), which takes less than 0.004ms (4us) on my box.