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

Negated character classes performance regression in Pattern

    XMLWordPrintable

    Details

      Description

      We observe a significant performance regression in the regex Pattern class for patterns containing negated character classes. The regression was introduced in JDK 9 when function objects implemented as anonymous inner classes in java.util.regex.Pattern were replaced by lambda functions.

      From jdk8u to the tip, CPU utilization increases from 2.14s to 3.25s, 51.8% more. The total runtime increases from 1.84s to 3.12s, or 1.7x slower.

      Test:
      perf stat -r 20 java -XX:-TieredCompilation Repro on x86_64 Linux.
      ----------------------------
      jdk8u:
                2,140.05 msec task-clock # 1.163 CPUs utilized ( +- 1.48% )
      ...
                 1.83939 +- 0.00343 seconds time elapsed ( +- 0.19% )

      ----------------------------
      jdk11u
                3,626.60 msec task-clock # 1.128 CPUs utilized ( +- 0.90% )
                 3.21589 +- 0.00658 seconds time elapsed ( +- 0.20% )

      ----------------------------
      tip(6d1d4d52928ed38bbc73ddcbede5389995a8e65f)
                3,257.17 msec task-clock # 1.043 CPUs utilized ( +- 0.15% )
                 3.12437 +- 0.00545 seconds time elapsed ( +- 0.17% )

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              simonis Volker Simonis
              Reporter:
              xliu Xin Liu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: