Optimize matching BMP Slice nodes

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs

      The Slice.match method contains a loop, which checks if matching hit the end of the input on each iteration:

                  for (int j=0; j<len; j++) {
                      if ((i+j) >= matcher.to) {
                          matcher.hitEnd = true;
                          return false;
                      }
                      if (buf[j] != seq.charAt(i+j))
                          return false;
                  }

      It would be more efficient to move this check out of the loop and do it only once.

            Assignee:
            Ivan Gerasimov
            Reporter:
            Ivan Gerasimov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: