RFR: 8334755: Asymptotically faster implementation of square root algorithm [v50]

fabioromano1 duke at openjdk.org
Fri Aug 2 06:33:36 UTC 2024


On Thu, 1 Aug 2024 21:38:47 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

> Mmh, benchmarks show a slight slowdown with the iterative variant (except for the XS case). I tried several times, this one is the most favorable run:
> 
> ```
> Benchmark                        Mode  Cnt      Score     Error  Units
> BigIntegerSquareRoot.testSqrtL   avgt   15   2862.103 ?  14.482  ns/op
> BigIntegerSquareRoot.testSqrtM   avgt   15    767.569 ?  22.197  ns/op
> BigIntegerSquareRoot.testSqrtS   avgt   15    249.484 ?  48.970  ns/op
> BigIntegerSquareRoot.testSqrtXL  avgt   15  22324.068 ? 147.290  ns/op
> BigIntegerSquareRoot.testSqrtXS  avgt   15      4.815 ?   0.108  ns/op
> ```

This can happen too. It had already happened to me once when I was trying to implement an iterative version of MergeSort, and strangely it was slower. It is still useful to test for comparing the two versions.

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

PR Comment: https://git.openjdk.org/jdk/pull/19710#issuecomment-2264661114


More information about the core-libs-dev mailing list