Integrated: 8355719: Reduce memory consumption of BigInteger.pow()

fabioromano1 duke at openjdk.org
Fri May 9 17:09:05 UTC 2025


On Wed, 16 Apr 2025 13:45:55 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.

This pull request has now been integrated.

Changeset: 1c5eb370
Author:    Fabio Romano <fabio19298 at gmail.com>
Committer: Raffaello Giulietti <rgiulietti at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1c5eb370b7dbe7558b535bf27c9df292c2007b9b
Stats:     329 lines in 2 files changed: 231 ins; 49 del; 49 mod

8355719: Reduce memory consumption of BigInteger.pow()

Reviewed-by: rgiulietti

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

PR: https://git.openjdk.org/jdk/pull/24690


More information about the core-libs-dev mailing list