The Computer Language
22.01 Benchmarks Game

C# .NET versus Java fastest programs

Always look at the source code. These are only the fastest programs.

If they are manually vectorized SIMD, does the host language matter? You might not be interested in the most optimised programs.

Look at "mandelbrot" or "spectral-norm" or other measurement tables. Look at the other programs. Choose which programs you want to compare.

regex-redux
source secs mem gz busy cpu load
C# .NET 1.39 318,212 1869 2.63 50% 21% 88% 30%
Java 5.34 862,848 929 17.08 74% 76% 97% 74%
n-body
source secs mem gz busy cpu load
C# .NET 3.18 32,632 2467 3.23 2% 99% 0% 1%
Java 6.77 35,672 1489 7.02 3% 99% 1% 1%
spectral-norm
source secs mem gz busy cpu load
C# .NET 0.82 34,824 764 3.00 96% 90% 90% 91%
Java 1.55 39,644 756 5.96 98% 96% 97% 95%
k-nucleotide
source secs mem gz busy cpu load
C# .NET 3.21 184,240 2044 11.03 95% 89% 89% 70%
Java 4.83 354,148 1812 15.82 87% 83% 81% 76%
mandelbrot
source secs mem gz busy cpu load
C# .NET 3.11 65,960 816 12.18 97% 99% 98% 97%
Java 4.10 70,448 796 16.11 99% 98% 98% 98%
fannkuch-redux
source secs mem gz busy cpu load
C# .NET 8.74 31,712 1225 34.71 99% 99% 100% 99%
Java 10.48 35,264 1282 41.33 98% 99% 99% 98%
pidigits
source secs mem gz busy cpu load
C# .NET 0.79 33,196 1168 0.81 98% 4% 0% 1%
Java 0.79 36,192 764 0.82 0% 4% 1% 99%
reverse-complement
source secs mem gz busy cpu load
C# .NET 1.58 1,029,116 1621 3.88 30% 94% 66% 54%
Java 1.57 678,512 2183 3.54 48% 59% 44% 75%
fasta
source secs mem gz busy cpu load
C# .NET 1.22 108,212 1691 4.45 93% 92% 91% 89%
Java 1.20 44,952 2543 3.50 79% 63% 78% 71%
binary-trees
source secs mem gz busy cpu load
C# .NET 4.90 1,651,992 705 15.90 77% 79% 79% 89%
Java 2.51 2,479,012 835 7.94 74% 92% 78% 71%
C# .NET

.NET SDK 6.0.101
Host Version: 6.0.1; Commit: 3a25a7f1cc
<ServerGarbageCollection>true</ServerGarbageCollection>

Java

openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)