> 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.
Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits: - Merge remote-tracking branch 'upstream/master' into optim_sb_append_chars_202504 # Conflicts: # src/java.base/share/classes/java/lang/StringUTF16.java - putCharsUnchecked - 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=02 Stats: 47 lines in 3 files changed: 40 ins; 0 del; 7 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