In BufferedReader.readLine and other similar scenarios, we need to use 
StringBuilder.append(char[]) to build the string.

For these scenarios, we can use the intrinsic method StringUTF16.compress and 
Unsafe.copyMemory instead of the character copy of the char-by-char loop to 
improve the speed.

-------------

Commit messages:
 - copyright
 - Using StringUTF16.compress to speed up LATIN1 StringBuilder append(char[])
 - Using Unsafe.copyMemory to speed up UTF16 StringBuilder append(char[])
 - add append(char[]) benchmark

Changes: https://git.openjdk.org/jdk/pull/24773/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24773&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8355177
  Stats: 46 lines in 3 files changed: 40 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/24773.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24773/head:pull/24773

PR: https://git.openjdk.org/jdk/pull/24773

Reply via email to