RFR: JDK-8318476: Add resource consumption note to BigInteger and BigDecimal

Raffaello Giulietti rgiulietti at openjdk.org
Sun Oct 22 11:27:40 UTC 2023


On Sat, 21 Oct 2023 00:56:21 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Add informative notes to BigInteger and BigDecimal about possible running times, etc.

src/java.base/share/classes/java/math/BigDecimal.java line 310:

> 308:  * time of operations can screen out {@code BigDecimal} values with
> 309:  * unscaled values or scales above a chosen magnitude.
> 310:  *

A paragraph about memory consumption is perhaps worthwhile as well.

src/java.base/share/classes/java/math/BigInteger.java line 127:

> 125:  * the input. For example, a method like {@link intValue()} would be
> 126:  * expected to run in <i>O</i>(1), that is constant time, since with
> 127:  * the current internal presentation only a fixed-size component of

Suggestion:

 * the current internal representation only a fixed-size component of

src/java.base/share/classes/java/math/BigInteger.java line 152:

> 150:  * time of operations can screen out {@code BigInteger} values above a
> 151:  * chosen magnitude.
> 152:  *

This explains the execution time characteristics but not the memory consumption aspects of the class.
I think that a couple of sentences about them would make this note more complete.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16298#discussion_r1367887343
PR Review Comment: https://git.openjdk.org/jdk/pull/16298#discussion_r1367886201
PR Review Comment: https://git.openjdk.org/jdk/pull/16298#discussion_r1367886932


More information about the core-libs-dev mailing list