-
Aug 6th, 2021, 02:14 PM
#1
B4J Primes Benchmark
B4J Primes Benchmark
Algorithm #1
B4J: 2.78
Java: 3.07
Java with the limit calculated before the loop (as in B4J): 2.91
C#: 2.69
Algorithm #2 - sieve
The C# code was fixed to only return the count of primes without collecting the primes, and the maximum was set to 200M.
B4J - same algorithm as the C# algorithm: 1.80
Java: 1.90
C#: 2.50
What does it mean?
The exact numbers aren't important. Small changes in the code can affect the results in unexpected ways due to the underlying compiler optimizations.
It does show that B4J, Java and C# have similar core performance.
Something to consider before touching the .Net tar baby. No need to get stuck.
-
Aug 6th, 2021, 03:38 PM
#2
Re: B4J Primes Benchmark
Btw, this impl is *not* using Sieve of Eratosthenes like here.
By using the sieve C# impl reduces elapsed time 10-fold.
cheers,
</wqw>
-
Aug 6th, 2021, 03:43 PM
#3
Re: B4J Primes Benchmark
Well if that's a 3rd algorithm maybe somebody should try that too.
But the point was that you can get comparable performance without moving to C# or directly to Java.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|