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

Converting bytes to hex string is unnecessarily slow

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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. BytesToHexBenchmark.java
          3 kB
          David Allsopp
        2. BytesToHexBenchmark2.java
          3 kB
          David Allsopp
        3. cassandra-2850a.diff
          5 kB
          David Allsopp
        4. 2850-v2.patch
          4 kB
          Sylvain Lebresne
        5. BytesToHexBenchmark3.java
          8 kB
          David Allsopp
        6. 2850-v4.patch
          6 kB
          David Allsopp
        7. 2850-v4a.patch
          5 kB
          David Allsopp
        8. 2850-rebased.txt
          5 kB
          Jonathan Ellis
        9. 2850-v5.patch
          7 kB
          David Allsopp
        10. 2850-v6_08.patch
          8 kB
          Sylvain Lebresne

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment