RFR: 8355719: Reduce memory consumption of BigInteger.pow() [v40]

Raffaello Giulietti rgiulietti at openjdk.org
Mon Apr 28 17:09:48 UTC 2025


On Mon, 28 Apr 2025 16:48:49 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> This PR optimizes `BigInteger.pow(int)` method. 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.
>
> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Added tests for memory consumption

Can you show the benchmark results before/after, perhaps specifying the characteristics of your machine (CPU make/model, RAM, OS)?

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

PR Comment: https://git.openjdk.org/jdk/pull/24690#issuecomment-2835918506


More information about the core-libs-dev mailing list