RFR: JDK-8323186: A faster algorithm for MutablebigInteger.divWord(long, int) [v3]

Raffaello Giulietti rgiulietti at openjdk.org
Mon Jan 22 15:17:29 UTC 2024


On Tue, 9 Jan 2024 18:24:49 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> The method `MutableBigInteger.divWord(long, int)` can use the algorithm of Hacker's Delight (2nd ed), section 9.3, the same used in `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`, to get the computation faster.
>
> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Removed trailing whitespaces

The test does not seem to check that the results are correct, but just measures elapsed time.

For this, in the context of the OpenJDK, we use [JMH](https://github.com/openjdk/jmh) for performance benchmarks. It avoids all the common issues with less sophisticated approaches. At first, it might seem harder to use, but it is more reliable than ad-hoc measurements. While not perfect, it has established itself as the "golden standard", so to say.

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

PR Comment: https://git.openjdk.org/jdk/pull/17291#issuecomment-1904217509


More information about the core-libs-dev mailing list