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

JNU_GetStringPlatformChars should have a fast path for UTF-8

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u131, 9, 10
    • Fix Version/s: 10
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b13

      Description

      In cases like UnixFileSystem.getBooleanAttributes0, the path of a File is transformed to a natively encoded char* by JNI code, with fast paths for various legacy charsets such as ISO-8859-1 and cp1252. In the case this encoding is UTF-8, however, there is no fast path, which means the JNI code will do an upcall to String.getBytes("UTF-8").

      Experiments (using the modified UTF-8 utilities available to JNI) indicates this can be quite a bit faster due to avoiding creating a temporary byte[], meaning a fast path for UTF-8 can help to achieve a speedup and reduce GC pressure when converting a lot of java Strings to native UTF-8 strings.

        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: