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

Use optimized Ques node for curly {0,1} quantifier

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 15
    • Component/s: core-libs
    • Labels:
      None

      Description

      The java.regex.Pattern engine has an optimized node Ques to represent the quantifier of type 'X?'.
      It would be beneficial, if the same optimized node was used for 'X{0,1}', which is essentially the same.

      Currently, a less efficient construct is used for the later expression:

      $java java.util.regex.PrintPattern 'X?'
         Pattern: X?
           0: <Start>
           1: <Ques GREEDY>
           2: <BmpCharProperty>
               </Ques>
           3: <END>

      $java java.util.regex.PrintPattern 'X{0,1}'
         Pattern: X{0,1}
           0: <Start>
           1: <Curly GREEDY {0, 1}>
           2: <BmpCharProperty>
               </Curly>
           3: <END>

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: