[ https://issues.apache.org/jira/browse/CASSANDRA-2850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13070069#comment-13070069 ]
David Allsopp edited comment on CASSANDRA-2850 at 7/23/11 10:32 PM: -------------------------------------------------------------------- OK - found bug, which only manifests when the ByteBuffer is at a non-zero position - the unit tests that directly test ByteBufferUtil don't test this circumstance, so will add something there, and recheck performance with a fixed version... Oddly, testCleanupWithIndexes (and others) pass fine if I run them from Eclipse individually, but they fail if run via the Ant test task. An aside - I initially couldn't get your patch to apply either - perhaps a newline character issue since I've been doing this work on Windows (never again!) - but, I did discover that it applied fine by setting the patch 'fuzz factor' to 2. was (Author: dallsopp): OK - found bug, which only manifests when the ByteBuffer is at a non-zero position - the unit tests that directly test ByteBufferUtil don't test this circumstance, so will add something there, and recheck performance with a fixed version... Oddly, testCleanupWithIndexes (and others) pass fine if I run them from Eclipse individually, but they fail if run via the Ant test task. An aside - I initially couldn't get your patch to apply either - perhaps a newline character issue since I've been doing this work on Windows (never again!) - but, I did discover that it applied fine using the patch function in Eclipse, by setting the 'fuzz factor' to 2. > 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 > Reporter: David Allsopp > Assignee: David Allsopp > Priority: Minor > Fix For: 0.8.3 > > Attachments: 2850-rebased.txt, 2850-v2.patch, 2850-v4.patch, > 2850-v4a.patch, BytesToHexBenchmark.java, BytesToHexBenchmark2.java, > BytesToHexBenchmark3.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