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

Andriy Plokhotnyuk duke at openjdk.org
Thu Sep 21 13:03:51 UTC 2023


On Thu, 21 Sep 2023 12:51:56 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

> 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.

I bet that `decNumberOfTrailingZeros` call will increase serialization time for values with short mantissa (like 1.23e-4) due to a dozen of dependent multiplication operations.

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

PR Comment: https://git.openjdk.org/jdk/pull/15861#issuecomment-1729520371


More information about the core-libs-dev mailing list