Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-06 Thread via GitHub
aherbert commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1981698426 Thanks for the contribution. -- 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

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-06 Thread via GitHub
aherbert merged PR #140: URL: https://github.com/apache/commons-numbers/pull/140 -- 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:

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-06 Thread via GitHub
aherbert commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1981690270 Confirmed performance of current code on MacBook Pro M2 using JDK 21: ``` Benchmark(numPairs) (seed) Mode CntScore Error Units

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-06 Thread via GitHub
mlangc commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1981405719 As discussed, I've reverted my change to the GCD implementation for ints, and adapted the benchmarks. Inspired by one of your earlier comments, I also added a benchmark that tests

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-04 Thread via GitHub
mlangc commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1977345525 Sounds good  , I can look into that in the coming days. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-04 Thread via GitHub
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

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-02 Thread via GitHub
mlangc commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1975073213 Thanks a lot for the detailed analysis. I've adapted the benchmark according to your suggestions: I've changed the default number of pairs to 100_000 and generate new pairs after

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-02 Thread via GitHub
aherbert commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1974831748 Installed the numbers-core module locally (forgot to do this at first). MacBook Pro M2: ``` mvn -v Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-02 Thread via GitHub
mlangc commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1509950338 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-02 Thread via GitHub
mlangc commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1509950259 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-02 Thread via GitHub
mlangc commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1509910402 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-02 Thread via GitHub
mlangc commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1509909938 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-01 Thread via GitHub
mlangc commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1509905219 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-01 Thread via GitHub
mlangc commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1509905194 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-01 Thread via GitHub
mlangc commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1509905160 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-01 Thread via GitHub
mlangc commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1509905117 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-01 Thread via GitHub
aherbert commented on code in PR #140: URL: https://github.com/apache/commons-numbers/pull/140#discussion_r1508877866 ## commons-numbers-examples/examples-jmh/src/main/java/org/apache/commons/numbers/examples/jmh/core/GcdPerformance.java: ## @@ -0,0 +1,236 @@ +package

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-01 Thread via GitHub
aherbert commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1973038477 It seems that commit history changed the int version in [NUMBERS-132](https://issues.apache.org/jira/browse/NUMBERS-132). This introduced the use of `numberOfTrailingZeros` for

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-03-01 Thread via GitHub
mlangc commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1972901325 After adding some benchmarks, I found out that the existing GCD implementation for ints is also very performant for longs, if only [one small change is made to

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-02-26 Thread via GitHub
mlangc commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1965186381 I did some further benchmarks, and it seems that the implementation for int is actually better left as is. I'll look more closely tomorrow or after tomorrow & share the results with

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-02-26 Thread via GitHub
mlangc commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1964714521 > Interesting analysis on your blog. It would be helpful if you apply the same changes to `public static int gcd(int p, int q)` too. Makes sense - I just pushed another commit

Re: [PR] Calculate GCD for longs more efficiently [commons-numbers]

2024-02-25 Thread via GitHub
aherbert commented on PR #140: URL: https://github.com/apache/commons-numbers/pull/140#issuecomment-1963089226 Interesting analysis on your blog. It would be helpful if you apply the same changes to `public static int gcd(int p, int q)` too. -- This is an automated message from the