On Sun, 11 May 2025 16:22:11 GMT, Johannes Graham <d...@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. macOS 15.4.1 / M1 Pro / 32 GiB RAM BigDecimals.testValueOfWithDouble avgt 15 12.448 ± 0.280 ns/op BigDecimals.testValueOfWithDoubleString avgt 15 115.253 ± 4.349 ns/op src/java.base/share/classes/jdk/internal/math/FormattedFPDecimal.java line 38: > 36: * f and e meeting d = f 10^e. > 37: * It then rounds d to the appropriate number of digits, as per > specification, > 38: * and extracts the digits of both the significand and, where required, > the® Suggestion: * and extracts the digits of both the significand and, where required, the ------------- PR Comment: https://git.openjdk.org/jdk/pull/25173#issuecomment-2872554601 PR Review Comment: https://git.openjdk.org/jdk/pull/25173#discussion_r2084591912