[ 
https://issues.apache.org/jira/browse/CASSANDRA-1043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863260#action_12863260
 ] 

Sylvain Lebresne commented on CASSANDRA-1043:
---------------------------------------------

Maybe can we also make it so that on same timestamp we don't compare again the 
first 8 bytes. Agreed 
it's no big deal as timestamp ties will not happen often but it do makes uuid 
comparisons faster :)

Other than that, in the return statement, shouldn't the part (hi << 0x0FFF) 
actually be (hi & 0x0FFF) ?

Moreover, I wonder about the last part (I'm not an UUID expert tough so feel 
free to correct me). The 
substraction first (that I guess is to make the timestamp retative to the 20th 
century instead of the 
16th one?) and the division by 10.
First I think it is a bit dangerous to not return the same thing that was 
returned before (the division may 
mean a loss of precision in particular (agreed, it's unlikely)). And second, as 
we don't really care here
about the actual value of the timestamp, we could skip these two operations and 
make that even faster. 

> Faster UUID comparisons
> -----------------------
>
>                 Key: CASSANDRA-1043
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1043
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: James Golick
>            Priority: Minor
>         Attachments: faster_uuid_compare.diff
>
>
> As I explained on the mailing list, doing slice queries on CFs that are 
> sorted by TimeUUIDType gets slower as the value of count increases. According 
> to my profiles, this is largely due to the fact that ConcurrentSkipListMap 
> calls the comparator very frequently, which is extremely inefficient. In 
> order to compare two UUIDs, it has to materialize them both in to 
> java.util.UUID objects which is quite slow. The more UUIDs to compare, the 
> slower it is.
> Attached is a patch that compares UUIDs by extracting the timestamp directly 
> from the byte[] representation. According to my tests, it's close to a 50% 
> performance improvement.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to