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

Avoid over-allocation of bytes for UTF8 string serialization

    XMLWordPrintableJSON

    Details

      Description

      In the current message encoding implementation, it first calculates the `encodeSize` and allocates the bytebuffer with that size.

      However, during encoding, it assumes the worst case of writing UTF8 string to allocate bytes, i.e. assuming each letter takes 3 bytes.

      The over-estimation further leads to resizing the underlying array and data copy.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                yifanc Yifan Cai
                Reporter:
                yifanc Yifan Cai
                Authors:
                Yifan Cai
                Reviewers:
                Aleksey Yeschenko
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m