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

Improve String::equals warmup characteristics

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 13
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b18

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: