Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8225466

Optimize matching BMP Slice nodes

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • None
    • 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.

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

              Created:
              Updated:
              Resolved: