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

JNU_GetStringPlatformChars should have a fast path for UTF-8

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 10
    • 8u131, 9, 10
    • core-libs
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: