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

Raffaello Giulietti rgiulietti at openjdk.org
Thu Oct 2 07:19:56 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 While the main algorithm seems correct, probably during next week I'd like to take another look at the code to see whether there are other cases at the extremes of the scale range that could lead to ±1 errors in the scale, or inadvertent overflows.

Are there other small enhancements to this PR you'd like to add, both in the main code and in the tests?

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

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


More information about the core-libs-dev mailing list