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.42 280,892 1869 2.69 30% 39% 86% 35%
Java 5.58 985,696 929 18.26 81% 77% 84% 85%
spectral-norm
source secs mem gz busy cpu load
C# .NET 0.82 35,048 764 2.99 89% 96% 89% 89%
Java 1.63 39,304 756 6.22 95% 97% 95% 95%
k-nucleotide
source secs mem gz busy cpu load
C# .NET 3.29 182,860 2044 11.20 99% 86% 66% 90%
Java 4.98 356,904 1812 16.25 78% 76% 96% 76%
n-body
source secs mem gz busy cpu load
C# .NET 4.83 32,756 1704 4.85 0% 0% 0% 100%
Java 6.74 35,844 1489 6.82 1% 100% 1% 0%
mandelbrot
source secs mem gz busy cpu load
C# .NET 3.14 64,940 1974 12.30 99% 98% 97% 97%
Java 4.15 69,136 796 16.29 98% 99% 98% 99%
fannkuch-redux
source secs mem gz busy cpu load
C# .NET 8.40 30,848 1225 33.29 99% 100% 99% 99%
Java 10.64 35,192 1282 41.91 99% 98% 99% 97%
reverse-complement
source secs mem gz busy cpu load
C# .NET 1.50 950,648 1310 4.29 93% 63% 93% 38%
Java 1.54 670,924 2183 3.51 46% 56% 48% 79%
pidigits
source secs mem gz busy cpu load
C# .NET 0.92 35,404 977 0.96 98% 3% 2% 1%
Java 0.93 36,552 764 0.98 2% 3% 1% 99%
fasta
source secs mem gz busy cpu load
C# .NET 1.21 152,684 1691 4.58 96% 97% 92% 93%
Java 1.21 44,620 2543 3.58 89% 75% 65% 68%
binary-trees
source secs mem gz busy cpu load
C# .NET 4.81 1,881,564 676 15.47 81% 74% 83% 83%
Java 2.48 1,722,848 835 7.88 98% 75% 71% 74%
C# .NET

.NET SDK 5.0.201
Host Version: 5.0.4; Commit: f27d337295
<ServerGarbageCollection>true</ServerGarbageCollection>

Java

openjdk 16 2021-03-16
OpenJDK Runtime Environment (build 16+36-2231)
OpenJDK 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)