RFR: 8331907: BigInteger and BigDecimal should use optimized division
Daniel Jeliński
djelinski at openjdk.org
Wed May 8 08:32:22 UTC 2024
On Wed, 8 May 2024 08:19:54 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:
> Replace the custom unsigned divide / remainder functions with the compiler-optimized Long.divideUnsigned / remainderUnsigned.
>
> No new tests. Existing tier1-3 tests continue to pass.
>
> I added a new set of divide benchmarks. Results in thread.
>
> I also removed the BigDecimal.toString benchmarks. They no longer serve their purpose - toString caches the returned value, so we were only benchmarking the cache access time.
Results before:
Benchmark Mode Cnt Score Error Units
BigDecimals.testHugeLargeDivide avgt 15 115.176 ± 0.965 ns/op
BigDecimals.testHugeSmallDivide avgt 15 82.652 ± 0.601 ns/op
BigDecimals.testLargeSmallDivide avgt 15 6.601 ± 0.320 ns/op
BigIntegers.testHugeLargeDivide avgt 15 53.905 ± 0.734 ns/op
BigIntegers.testHugeSmallDivide avgt 15 52.762 ± 0.354 ns/op
BigIntegers.testLargeSmallDivide avgt 15 22.990 ± 0.058 ns/op
after:
Benchmark Mode Cnt Score Error Units
BigDecimals.testHugeLargeDivide avgt 15 106.549 ± 0.695 ns/op
BigDecimals.testHugeSmallDivide avgt 15 68.339 ± 0.172 ns/op
BigDecimals.testLargeSmallDivide avgt 15 6.594 ± 0.328 ns/op
BigIntegers.testHugeLargeDivide avgt 15 29.576 ± 0.411 ns/op
BigIntegers.testHugeSmallDivide avgt 15 30.072 ± 0.242 ns/op
BigIntegers.testLargeSmallDivide avgt 15 8.034 ± 0.078 ns/op
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19134#issuecomment-2100030115
More information about the core-libs-dev
mailing list