RFR: 8077587: BigInteger Roots [v19]
fabioromano1
duke at openjdk.org
Thu Apr 24 20:21:52 UTC 2025
On Thu, 24 Apr 2025 18:17:38 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
> * Performance enhancements in `pow()`, which is of general interest and does not require submitting a [CSR](https://wiki.openjdk.org/display/csr/Main).
@rgiulietti Yes, but here, the primary enhancement in `pow()` is not concerned most on execution time, but rather in memory optimization, because the PR implementation does the "shift of the exponent" squaring the result rather than the base, so the base is not squared like in the current implementation, and this permits to save about half of the memory.
> To make progress here, I suggest to split this PR in two, if technically possible:
>
> * One for the enhancements in `pow`, with JMH results before/after.
> * Another PR for the proposed _n_-th root.
I'm not very sure if it is technically possible, because both `pow()` and `nthRoot()` requires the computation of a power of a long, so that code has to be shared by both methods, and so a supposed PR for `nthRoot()` would require that method.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24690#issuecomment-2828760458
More information about the core-libs-dev
mailing list