Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-16171

String operation on varstring results in extra call to strlen

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0.0
    • Component/s: Code Generator
    • Labels:
      None

      Description

      For example, calling STD.Str.ToLowerCase transform against a varstring fields results in:

              virtual size32_t transform(ARowBuilder & crSelf, const void * _left) {
                      crSelf.getSelf();
                      unsigned char * left = (unsigned char *)_left;
                      rtlDataAttr v1; 
                      unsigned v2; 
                      slStringToLowerCase(v2,v1.refstr(),strlen((char *)(left + 0U)),(char *)(left + 0U));
                      crSelf.ensureCapacity(v2 + 1U,"postcode");
                      rtlStrToVStr(v2 + 1U,(char *)(crSelf.row() + 0U),v2,v1.getstr());
                      unsigned v3 = strlen((char *)(crSelf.row() + 0U)) + 1U; 
                      return v3; 
              }
      

      The strlen function call is unneccessary - the length is already available as v2 + 1U

        Attachments

          Activity

            People

            • Assignee:
              shamser Shamser Ahmed
              Reporter:
              shamser Shamser Ahmed
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: