Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-3070

Unnecessary use of UUID.randomUUID()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.8.0
    • 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.

      Attachments

        1. 3070.txt
          1 kB
          Lars Hofhansl

        Activity

          People

            larsh Lars Hofhansl
            larsh Lars Hofhansl
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: