aherbert commented on PR #140:
URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1976524897

   Intel(R) Xeon(R) CPU E5-1680 v3 @ 3.20GHz
   
   ```
   JDK 11.0.22, OpenJDK 64-Bit Server VM, 11.0.22+7-post-Ubuntu-0ubuntu220.04.1
   
   Benchmark                               (numPairs)  (seed)   Mode  Cnt    
Score   Error  Units
   GcdPerformance.gcdBigInteger                100000      42  thrpt   10   
14.922 ± 0.164  ops/s
   GcdPerformance.gcdInt                       100000      42  thrpt   10  
149.786 ± 0.470  ops/s
   GcdPerformance.gcdLong                      100000      42  thrpt   10   
82.026 ± 0.437  ops/s
   GcdPerformance.oldGcdInt                    100000      42  thrpt   10  
149.918 ± 3.116  ops/s
   GcdPerformance.oldGcdIntAdaptedForLong      100000      42  thrpt   10   
45.550 ± 0.068  ops/s
   GcdPerformance.oldGcdLong                   100000      42  thrpt   10   
24.903 ± 0.085  ops/s
   
   JDK 21, OpenJDK 64-Bit Server VM, 21+35-2513
   
   Benchmark                               (numPairs)  (seed)   Mode  Cnt    
Score   Error  Units
   GcdPerformance.gcdBigInteger                100000      42  thrpt   10   
15.186 ± 0.055  ops/s
   GcdPerformance.gcdInt                       100000      42  thrpt   10  
171.424 ± 0.222  ops/s
   GcdPerformance.gcdLong                      100000      42  thrpt   10   
84.787 ± 1.057  ops/s
   GcdPerformance.oldGcdInt                    100000      42  thrpt   10  
177.836 ± 0.261  ops/s
   GcdPerformance.oldGcdIntAdaptedForLong      100000      42  thrpt   10   
56.996 ± 0.155  ops/s
   GcdPerformance.oldGcdLong                   100000      42  thrpt   10   
24.625 ± 0.341  ops/s
   ```
   
   Here the two int versions are the same on JDK 11 and the old version faster 
on JDK 21. The new long version is again faster than the 
oldGcdIntAdaptedForLong.
   
   So on two machines the int versions are roughly the same speed (your machine 
has a 2% advantage to the new version). On the M2 processor the old int version 
is 9% faster, and 3.5% faster on the Xeon processor on JDK 21.
   
   I would be in favour of keeping the old int version and updating to the new 
long version (for a 3-4x speed-up). This would require the previously mentioned 
comment in the code as to why we have two slightly different versions. It would 
also require a change to transfer the core implementation to the benchmark as 
`gcdLongAdaptedForInt` and rename the int complement to `gcdIntAdaptedForLong`.
   
   Thoughts?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to