RFR: 8316662: Remove one allocation per conversion in Double.toString(double) and Float.toString(float)
ExE Boss
duke at openjdk.org
Thu Sep 21 22:04:14 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.
These constant names should be in uppercase:
src/java.base/share/classes/jdk/internal/math/DoubleToDecimal.java line 110:
> 108: private static final int NAN = 5;
> 109:
> 110: private static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
Suggestion:
private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
src/java.base/share/classes/jdk/internal/math/FloatToDecimal.java line 110:
> 108: private static final int NAN = 5;
> 109:
> 110: private static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
Suggestion:
private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
-------------
PR Review: https://git.openjdk.org/jdk/pull/15861#pullrequestreview-1638247433
PR Review Comment: https://git.openjdk.org/jdk/pull/15861#discussion_r1333314116
PR Review Comment: https://git.openjdk.org/jdk/pull/15861#discussion_r1333316192
More information about the core-libs-dev
mailing list