The Computer Language
Benchmarks Game

C# .NET versus Java fastest programs

Always look at the source code.

These are only the fastest programs. Do some of them use manually vectorized SIMD? Look at the other programs. They may seem more-like a fair comparison to you.

regex-redux
source secs mem gz busy cpu load
C# .NET 1.43 320,400 1869 2.67 33% 39% 85% 31%
Java 5.70 656,328 929 18.25 89% 76% 79% 75%
spectral-norm
source secs mem gz busy cpu load
C# .NET 0.82 34,720 764 2.98 91% 88% 89% 98%
Java 1.68 38,348 950 6.43 96% 96% 96% 95%
k-nucleotide
source secs mem gz busy cpu load
C# .NET 3.28 182,680 2044 11.09 87% 83% 73% 94%
Java 5.00 408,040 1812 16.36 74% 81% 86% 86%
n-body
source secs mem gz busy cpu load
C# .NET 4.86 32,760 1742 4.96 0% 1% 100% 2%
Java 6.75 35,200 1489 6.83 0% 0% 100% 1%
fannkuch-redux
source secs mem gz busy cpu load
C# .NET 8.40 30,788 1225 33.30 100% 99% 99% 99%
Java 11.00 34,104 1282 43.42 99% 98% 98% 99%
mandelbrot
source secs mem gz busy cpu load
C# .NET 3.14 64,716 1974 12.28 99% 97% 97% 97%
Java 4.11 68,204 796 16.20 98% 99% 98% 99%
binary-trees
source secs mem gz busy cpu load
C# .NET 2.35 807,172 753 7.82 83% 88% 84% 78%
Java 2.50 2,487,096 835 7.90 88% 75% 75% 79%
reverse-complement
source secs mem gz busy cpu load
C# .NET 1.48 959,848 1310 4.18 30% 63% 93% 96%
Java 1.54 702,332 2183 3.55 78% 46% 49% 57%
fasta
source secs mem gz busy cpu load
C# .NET 1.16 96,136 1691 4.31 96% 95% 92% 89%
Java 1.20 44,124 2543 3.61 79% 86% 69% 65%
pidigits
source secs mem gz busy cpu load
C# .NET 0.83 31,700 1168 1.02 1% 2% 21% 98%
Java 0.79 35,568 764 0.84 99% 3% 3% 1%
C# .NET

.NET SDK 5.0.100
Host Version: 5.0.0; Commit: cf258a14b7
<ServerGarbageCollection>true

Java

openjdk 15 2020-09-15
OpenJDK Runtime Environment (build 15+36-1562)
OpenJDK 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)