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

Optimize matching BMP Slice nodes

    XMLWordPrintable

    Details

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

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: