RFR: 8367603: Optimize exact division in BigDecimal [v15]

Raffaello Giulietti rgiulietti at openjdk.org
Mon Sep 29 13:20:39 UTC 2025


On Thu, 25 Sep 2025 17:37:34 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Comments
>
> Master branch results:
> 
> Benchmark                           Mode  Cnt       Score        Error  Units
> BigDecimalDivide.testExactDivideL   avgt   15  109800.570 ±   4612.510  ns/op
> BigDecimalDivide.testExactDivideM   avgt   15   18786.818 ±    725.330  ns/op
> BigDecimalDivide.testExactDivideS   avgt   15    9764.192 ±     98.841  ns/op
> BigDecimalDivide.testExactDivideXL  avgt   15  976249.610 ± 194313.150  ns/op
> BigDecimalDivide.testExactDivideXS  avgt   15    7782.170 ±    209.999  ns/op
> ``` 
> 
> PR branch results:
> 
> Benchmark                           Mode  Cnt      Score     Error  Units
> BigDecimalDivide.testExactDivideL   avgt   15   9323.939 ± 302.617  ns/op
> BigDecimalDivide.testExactDivideM   avgt   15   5367.752 ±  87.323  ns/op
> BigDecimalDivide.testExactDivideS   avgt   15   4514.351 ±  79.579  ns/op
> BigDecimalDivide.testExactDivideXL  avgt   15  37474.101 ± 601.947  ns/op
> BigDecimalDivide.testExactDivideXS  avgt   15   3983.560 ±  60.067  ns/op

@fabioromano1 The existing tests didn't reveal the incorrect handling in this extreme cases (preferred scale exceeding the int range).
Could you please add a specific test case, maybe in test/jdk/java/math/BigDecimal/DivideTests.java?

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

PR Comment: https://git.openjdk.org/jdk/pull/27271#issuecomment-3346906794


More information about the core-libs-dev mailing list