JDK-8355719 : Reduce memory consumption of BigInteger.pow()
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.math
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-04-28
  • Updated: 2025-05-09
  • Resolved: 2025-05-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 masterFixed
Related Reports
Relates :  
Description
Reduce memory consumption of BigInteger.pow() by adopting a better computation strategy.
By iterating the exponent bits from left to right (from most to least significant), only the current running result needs to be squared and multiplied, while the base is untouched.
The memory savings are substantial, up to 45% w.r.t. the current implementation.
Comments
Changeset: 1c5eb370 Branch: master Author: Fabio Romano <fabio19298@gmail.com> Committer: Raffaello Giulietti <rgiulietti@openjdk.org> Date: 2025-05-09 17:06:33 +0000 URL: https://git.openjdk.org/jdk/commit/1c5eb370b7dbe7558b535bf27c9df292c2007b9b
09-05-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24690 Date: 2025-04-16 13:45:55 +0000
28-04-2025