You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Lars Hofhansl (JIRA)" <ji...@apache.org> on 2016/07/13 22:45:20 UTC

[jira] [Created] (PHOENIX-3070) Unnecessary use of UUID.randomUUID()

Lars Hofhansl created PHOENIX-3070:
--------------------------------------

             Summary: Unnecessary use of UUID.randomUUID()
                 Key: PHOENIX-3070
                 URL: https://issues.apache.org/jira/browse/PHOENIX-3070
             Project: Phoenix
          Issue Type: Bug
            Reporter: Lars Hofhansl


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.07ms (70us), or even better: {{new UUID(ThreadLocalRandom.current().nextLong(), random.nextLong())}}, which takes less than 0.02ms (20us) on my box.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)