On Wed, 30 Apr 2025 15:59:05 GMT, fabioromano1 <d...@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:
> 
>   Simplify long power computing

> Is there a reason this cannot simply be the traditional "repeated square" 
> method? Why this complexity?

@rgiulietti By the way, could make sense recycling this algorithm scheme to 
speed up the computing of powers of `int`s that don't fit into a `long`, using 
`unsignedLongPow(long, int)` instead of `Math.pow()`?

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

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

Reply via email to