RFR: 8367603: Optimize exact division in BigDecimal [v17]
Raffaello Giulietti
rgiulietti at openjdk.org
Fri Sep 26 12:58:31 UTC 2025
On Fri, 26 Sep 2025 07:34:55 GMT, fabioromano1 <duke at openjdk.org> wrote:
>> A formula to lower the overestimate for the precision of an exact quotient, without introducing too expensive operations of division on numerator and denominator.
>
> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>
> Minor change
I can confirm the substantial speedups.
On macOS 15.7/MacBook Pro/M1 Pro + 32 GiB
before
Benchmark Mode Cnt Score Error Units
BigDecimalDivide.testExactDivideL avgt 15 64633.600 ± 2371.205 ns/op
BigDecimalDivide.testExactDivideM avgt 15 7861.471 ± 310.141 ns/op
BigDecimalDivide.testExactDivideS avgt 15 2255.149 ± 49.171 ns/op
BigDecimalDivide.testExactDivideXL avgt 15 429182.687 ± 4048.599 ns/op
BigDecimalDivide.testExactDivideXS avgt 15 1553.006 ± 39.593 ns/op
after
Benchmark Mode Cnt Score Error Units
BigDecimalDivide.testExactDivideL avgt 15 3348.603 ± 70.500 ns/op
BigDecimalDivide.testExactDivideM avgt 15 1141.554 ± 23.310 ns/op
BigDecimalDivide.testExactDivideS avgt 15 877.720 ± 20.571 ns/op
BigDecimalDivide.testExactDivideXL avgt 15 20038.746 ± 418.701 ns/op
BigDecimalDivide.testExactDivideXS avgt 15 780.262 ± 5.139 ns/op
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27271#issuecomment-3338607330
More information about the core-libs-dev
mailing list