RFR: 8355177: Speed up StringBuilder::append(char[]) via Unsafe::copyMemory [v8]

Shaojin Wen swen at openjdk.org
Fri Jun 27 01:04:32 UTC 2025


> In BufferedReader.readLine and other similar scenarios, we need to use StringBuilder.append(char[]) to build the string.
> 
> For these scenarios, we can Unsafe.copyMemory instead of the character copy of the char-by-char loop to improve the speed.
> 
> @RogerRiggs completed the optimization when the encoder is LATIN1 in PR #24967. This PR continues to complete the optimization when the encoder is UTF16.

Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:

  Update src/java.base/share/classes/java/lang/StringUTF16.java
  
  Co-authored-by: Chen Liang <liach at openjdk.org>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24773/files
  - new: https://git.openjdk.org/jdk/pull/24773/files/18463718..4378fdfd

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24773&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24773&range=06-07

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 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


More information about the core-libs-dev mailing list