phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PHOENIX-3070) Unnecessary use of UUID.randomUUID()
Date Fri, 12 Aug 2016 15:12:22 GMT

     [ https://issues.apache.org/jira/browse/PHOENIX-3070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

James Taylor updated PHOENIX-3070:
----------------------------------
    Fix Version/s:     (was: 4.8.1)
                   4.8.0

> 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
>            Assignee: Lars Hofhansl
>            Priority: Minor
>             Fix For: 4.8.0
>
>         Attachments: 3070.txt
>
>
> 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.



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

Mime
View raw message