cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Allsopp (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-2850) Converting bytes to hex string is unnecessarily slow
Date Sun, 03 Jul 2011 17:35:21 GMT


David Allsopp commented on CASSANDRA-2850:

Just a note as to why might matter (in the absence of hard profiling data) - hexToBytes()
is called in a lot of places in the code, and is sometimes called on the entire column value.

A column value of 10MB takes over 750ms to convert on my machine (180ms with the patch), so
it's significant load - and column values go up to 2GB (extrapolating linearly, 2GB could
take over 2 minutes to convert, assuming you've got the spare RAM!).

> Converting bytes to hex string is unnecessarily slow
> ----------------------------------------------------
>                 Key: CASSANDRA-2850
>                 URL:
>             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:, cassandra-2850.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:


View raw message