The Computer Language
Benchmarks Game

C# .NET versus C++ g++ 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.

spectral-norm
source secs mem gz busy cpu load
C# .NET 0.82 34,720 764 2.98 91% 88% 89% 98%
C++ g++ 0.72 1,216 1044 2.86 100% 100% 99% 100%
n-body
source secs mem gz busy cpu load
C# .NET 4.86 32,760 1742 4.96 0% 1% 100% 2%
C++ g++ 4.09 1,800 1808 4.13 100% 0% 0% 0%
regex-redux
source secs mem gz busy cpu load
C# .NET 1.43 320,400 1869 2.67 33% 39% 85% 31%
C++ g++ 1.08 203,816 1315 3.38 78% 99% 65% 73%
pidigits
source secs mem gz busy cpu load
C# .NET 0.83 31,700 1168 1.02 1% 2% 21% 98%
C++ g++ 0.60 4,944 986 2.38 100% 100% 98% 100%
fasta
source secs mem gz busy cpu load
C# .NET 1.16 96,136 1691 4.31 96% 95% 92% 89%
C++ g++ 0.78 2,468 2751 1.62 8% 99% 99% 3%
k-nucleotide
source secs mem gz busy cpu load
C# .NET 3.28 182,680 2044 11.09 87% 83% 73% 94%
C++ g++ 1.95 156,372 1631 5.95 73% 70% 92% 70%
fannkuch-redux
source secs mem gz busy cpu load
C# .NET 8.40 30,788 1225 33.30 100% 99% 99% 99%
C++ g++ 4.91 1,912 1482 19.45 100% 99% 97% 100%
binary-trees
source secs mem gz busy cpu load
C# .NET 2.35 807,172 753 7.82 83% 88% 84% 78%
C++ g++ 1.04 154,824 1122 3.74 88% 100% 88% 86%
reverse-complement
source secs mem gz busy cpu load
C# .NET 1.48 959,848 1310 4.18 30% 63% 93% 96%
C++ g++ 0.63 499,704 2093 0.64 0% 100% 2% 0%
mandelbrot
source secs mem gz busy cpu load
C# .NET 3.14 64,716 1974 12.28 99% 97% 97% 97%
C++ g++ 0.84 34,604 3542 3.28 98% 99% 98% 95%
C# .NET

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

C++ g++

g++ (Ubuntu 10.2.0-13ubuntu1) 10.2.0