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.
Quote:
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.