Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-12373

Implement Small String Optimization for StringValue

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Impala 4.4.0
    • None
    • ghx-label-2

    Description

      Implement Small String Optimization for StringValue.

      Current memory layout of StringValue is:

        char* ptr;  // 8 byte
        int len;    // 4 byte
      

      For small strings with size up to 8 we could store the string contents in the bytes of the 'ptr'. Something like that:

        union {
          char* ptr;
          char small_buf[sizeof(ptr)];
        };
        int len;
      

      Many C++ string implementations use the Small String Optimization to speed up work with small strings. For example:

      Microsoft STL, libstdc++, libc++, Boost, Folly.

      Attachments

        1. small_string.cpp
          2 kB
          Zoltán Borók-Nagy

        Issue Links

          Activity

            People

              boroknagyz Zoltán Borók-Nagy
              boroknagyz Zoltán Borók-Nagy
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: