RFR: 8316662: Remove one allocation per conversion in Double.toString(double) and Float.toString(float)

Raffaello Giulietti rgiulietti at openjdk.org
Thu Sep 21 13:01:10 UTC 2023


By correctly sizing an intermediate `byte[]` and making use of the internal `newStringNoRepl()` method, one allocation per conversion can be avoided when the runtime uses compact strings.

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

Commit messages:
 - 8316662: Remove one allocation per conversion in Double.toString(double) and Float.toString(float)

Changes: https://git.openjdk.org/jdk/pull/15861/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15861&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8316662
  Stats: 388 lines in 3 files changed: 161 ins; 108 del; 119 mod
  Patch: https://git.openjdk.org/jdk/pull/15861.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15861/head:pull/15861

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


More information about the core-libs-dev mailing list