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

Implement fast-path for ASCII-compatible CharsetEncoders on x86

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b17
    • CPU:
      x86
    • OS:
      generic

      Backports

        Description

        A regression and performance discrepancy was reported where some CharsetEncoders are much slower than string.getBytes for the same encoding, particularly UTF-8.

        Analysis shows there's a regression to the UTF-8 CharsetEncoder caused by CompactStrings in JDK 9, while much of the performance difference between UTF_8$Encoder and String.getBytes(UTF-8) is really due to the latter taking advantage of some optimized intrinsics and seeing a large speed-up in JDK 9.

        Still, to fix the regression it made most sense to explore ways to take advantage of the existing intrinsics from various CharsetEncoders. The best result comes from extending the ISO_8859_1.implEncodeISOArray intrinsic to work also for ASCII encoding, which makes UTF_8$Encoder perform on par with (or outperform) string.getBytes(UTF-8). Extending the intrinsic on all platforms appear feasible, but it was only straightforward on x86. Since it doesn't seem reasonable to hold this fix up until implemented on all supported platforms I've limited it to x86 and will file follow-ups for the other platforms.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: