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

Avoid recalculating String.hash when zero

    XMLWordPrintable

    Details

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

      Description

      As suggested in RFR thread for JDK-8221723 (http://mail.openjdk.java.net/pipermail/core-libs-dev/2019-April/059480.html) we can add a boolean/byte to String to mark that a String.hash has been calculated as zero with neither footprint nor notable performance penalties.

      On top of the patch suggested by Peter, we should make the VM code cooperate when necessary, but with the suggested approach VM code typically does not need to set the hashIsZero flag to be semantically consistent.

        Attachments

          Activity

            People

            Assignee:
            redestad Claes Redestad
            Reporter:
            redestad Claes Redestad
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: