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

Speed up String::encodeASCII using countPositives

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • None
    • core-libs
    • None
    • b11

      When encoding Strings to US-ASCII we can speed things up the normal path significantly by using StringCoding.countPositives. Once a non-ASCII char is encountered we fall back to the slow loop.

      An alternative could be unrolling or using a byte array VarHandle, as show-cased by Brett Okken here: https://mail.openjdk.org/pipermail/core-libs-dev/2023-February/100573.html

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

              Created:
              Updated:
              Resolved: