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

Improve String::equals warmup characteristics

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • None
    • core-libs
    • b18

      The pattern coder() == other.coder() is used in several places in String, motivated by the fact each methods will evaluate the static final COMPACT_STRINGS and thus allow code paths to be removed by JIT when necessary.

      The high number of method calls can be a problem during startup/warmup, however, and it might be possible to tune this up without affecting or even improving peak performance in some cases.

      Ideas to explore:
      - add sameCoder(String) http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-December/057191.html
      - early length check http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-December/057181.html
      - replace inner branch Arrays.equals http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-December/057183.html

      Combining the first two ideas appear peak performance neutral (for both -XX:-/+CompactStrings) in a couple of simple tests, but twice as fast during startup. Will test a few other ideas and experiment with better micros.

            redestad Claes Redestad
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: