Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-2850

Converting bytes to hex string is unnecessarily slow

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 0.8.3
    • None
    • None

    Description

      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.

      Attachments

        1. 2850-rebased.txt
          5 kB
          Jonathan Ellis
        2. 2850-v2.patch
          4 kB
          Sylvain Lebresne
        3. 2850-v4.patch
          6 kB
          David Allsopp
        4. 2850-v4a.patch
          5 kB
          David Allsopp
        5. 2850-v5.patch
          7 kB
          David Allsopp
        6. 2850-v6_08.patch
          8 kB
          Sylvain Lebresne
        7. BytesToHexBenchmark.java
          3 kB
          David Allsopp
        8. BytesToHexBenchmark2.java
          3 kB
          David Allsopp
        9. BytesToHexBenchmark3.java
          8 kB
          David Allsopp
        10. cassandra-2850a.diff
          5 kB
          David Allsopp

        Activity

          People

            dallsopp David Allsopp
            dallsopp David Allsopp
            David Allsopp
            Sylvain Lebresne
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: