RFR: 8318457: Use prefix-less prepend methods directly to reduce branches in String concat expressions

Claes Redestad redestad at openjdk.org
Wed Oct 18 15:51:24 UTC 2023


In #16006 using `StringConcatFactory` seem to induce a run-to-run variance. One idea to reduce this is to generate expression trees with fewer branches by looking up and using the prefix-less `prepend` methods directly for cases where constant is null/empty so that the prefixed prepender will always deal with a non-null prefix constant.

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

Commit messages:
 - Naming consistency: noPrefixPrepender
 - FormatItem should call prepend(long, byte[], String)
 - Merge branch 'master' into scf_less_branches
 - Rename NULL to NO_PREFIX to better describe what these are for
 - Only generate prepend with prefix on non-null constants to avoid branch misses and JIT speculation issues

Changes: https://git.openjdk.org/jdk/pull/16244/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16244&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8318457
  Stats: 36 lines in 3 files changed: 14 ins; 9 del; 13 mod
  Patch: https://git.openjdk.org/jdk/pull/16244.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16244/head:pull/16244

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


More information about the core-libs-dev mailing list