On Thu, 5 Mar 2026 14:12:49 GMT, Ferenc Rakoczi <[email protected]> wrote:
>> Shawn Emery has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Optimize multByInt() method
>
> src/java.base/share/classes/sun/security/util/math/intpoly/IntegerPolynomial25519.java
> line 105:
>
>> 103: */
>> 104: @Override
>> 105: protected void multByInt(long[] a, long b) {
>
> Probably we should gain some more speed by special casing b = 2, 3 and 4 (by
> just shifting (+ adding) all limb values before the reduce() call.
@ferakocz and I have talked offline as EdDSA does multiply by 2 after
multiplying two operands and after squaring. However we've determined to not
implement the 2-multiply optimization in this PR given the following reasons:
i) the check and shift operation inline with the current implementation only
gains 1.37%
ii) the better gain of 2.18% requires adding public interfaces (e.g.,
setDoubledProduct() and setDoubledSquare)
iii) this optimization could provide better performance for other curves (e.g.,
secp) as well
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29981#discussion_r2908569143