On Mon, 28 Apr 2025 07:29:10 GMT, fabioromano1 <d...@openjdk.org> wrote:
>> src/java.base/share/classes/java/math/BigInteger.java line 2746: >> >>> 2744: if (exp <= maxExp) { >>> 2745: // don't use fp arithmetic if exp <= 3 >>> 2746: xToExp = exp == 1 ? x : >> >> What about pre-seeding the cache with values for 1, 2 and 3? That would >> allow unconditionally using fp here (and below) > >> What about pre-seeding the cache with values for 1, 2 and 3? That would >> allow unconditionally using fp here (and below) > > It's a good idea, but doing so would increase the already high dependence of > `computePower()` by the preconditions given by `unsignedLongPow()`, so at > this point I wonder if it will still make sense to maintain the code > separated, rather than putting it in `unsignedLongPow()` and throw away > `computePower()`... Doesn't pre-seeding involve extra cpu cycles which are defintely wasted if the results aren't used? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24690#discussion_r2063752957