RFR: 8356709: Avoid redundant String formatting in BigDecimal.valueOf(double)
Raffaello Giulietti
rgiulietti at openjdk.org
Wed May 14 14:43:54 UTC 2025
On Sun, 11 May 2025 16:32:02 GMT, Johannes Graham <duke at openjdk.org> wrote:
>> Optimize `BigDecimal.valueOf(double)` by using `FormattedFPDecimal` instead of converting to decimal string and then parsing it. This results in an approximate 6x improvement for me.
>
> On Aarch64 M4:
>
> Benchmark Mode Cnt Score Error Units
> + BigDecimals.testValueOfWithDouble avgt 15 9.913 ± 0.080 ns/op
> - BigDecimals.testValueOfWithDoubleString avgt 15 65.846 ± 0.801 ns/op
Thanks @j3graham for this nice enhancement!
Before approval, let's give another 24 hours for people around the globe to have a chance for further comments.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25173#issuecomment-2880505868
More information about the core-libs-dev
mailing list