On Sun, 9 Aug 2026 01:34:27 GMT, Shawn Emery <[email protected]> wrote:

>> This fix allows for more accurate comparisons between intrinsics and Java 
>> performance for P256 conditional set operations by emulating production 
>> lookup EC operations.  Before this fix, benchmarks showed a 53% regression 
>> for intrinsics vs. Java due to constant propagation and dead-code removal by 
>> C2.  After this fix, a 52% performance increase is observed with intrinsics 
>> vs. Java.
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Shawn Emery has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Emulate production operations via EC lookups

test/micro/org/openjdk/bench/javax/crypto/full/PolynomialP256Bench.java line 
139:

> 137:         // prevent constant folding.  Previously, C2 would perform 
> constant
> 138:         // propagation and remove the subsequent dead-code where 0 was 
> input.
> 139:         for (int j = 0; j < SET; j++) {

We could just do this:


        MutableIntegerModuloP test1 = X.mutable();
        MutableIntegerModuloP test2 = one.mutable();
        for (int i = 0; i< 10000; i++) {
            int bits = i * 2654435769u;
            test1.conditionalSet(test2, bits & (1 << 24)); // The exact bit 
numbers don't matter, but don't use the low bits
            test1.conditionalSet(test2, bits & (2 << 24));
            test2.conditionalSet(test1, bits & (4 << 24));
            test2.conditionalSet(test1, bits & (8 << 24));


which should get us something unbiased and unpredictable.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32047#discussion_r3743235768

Reply via email to