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

David Allsopp commented on CASSANDRA-2850:
------------------------------------------

Updated diff (2850a) includes the same optimisation in both the FBUtilities 
version and the ByteBufferUtils version, with similar x3 speedup in each case. 
Now uses a literal lookup table rather than generating it in static block.

> Converting bytes to hex string is unnecessarily slow
> ----------------------------------------------------
>
>                 Key: CASSANDRA-2850
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2850
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 0.7.6, 0.8.1
>            Reporter: David Allsopp
>            Priority: Minor
>             Fix For: 0.8.2
>
>         Attachments: BytesToHexBenchmark.java, BytesToHexBenchmark2.java, 
> cassandra-2850a.diff
>
>
> ByteBufferUtil.bytesToHex() is unnecessarily slow - it doesn't pre-size the 
> StringBuilder (so several re-sizes will be needed behind the scenes) and it 
> makes quite a few method calls per byte.
> (OK, this may be a premature optimisation, but I couldn't resist, and it's a 
> small change)
> Will attach patch shortly that speeds it up by about x3, plus benchmarking 
> test.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to