The Computer Language
24.11 Benchmarks Game

C# .NET versus Go fastest performance

How the programs are written matters! Always look at the source code.

If the fastest programs are * hand-written vector instructions, does the host language matter? You might be more interested in the less optimised programs — more seconds, less gz source code.

fannkuch-redux
source secs mem gz cpu secs
* C# .NET #5 2.27 29,584 1485 8.79
C# .NET #2 30.38 28,804 584 30.37
Go #3 8.34 19,808 975 33.31
* C# .NET #9 8.40 29,608 1232 33.33
C# .NET #6 9.93 29,272 1075 39.49
C# .NET #3 11.01 29,020 1117 43.46
C# .NET #8 43.80 28,760 519 43.78
Go #8 46.13 19,440 500 46.24
Go 12.29 19,808 906 49.04
Go #2 12.35 19,808 903 49.32
n-body
source secs mem gz cpu secs
* C# .NET #9 3.17 28,604 2480 3.17
* C# .NET #4 3.75 28,504 2137 3.75
* C# .NET #7 4.80 28,564 1715 4.80
* C# .NET #6 4.83 28,512 1754 4.83
Go #3 6.38 19,808 1207 6.40
C# .NET #3 6.65 29,280 1311 6.64
C# .NET #2 6.89 29,284 1339 6.89
Go 7.01 19,808 1316 7.03
Go #2 7.03 19,808 1222 7.05
C# .NET #8 7.21 29,068 1335 7.21
C# .NET #0 7.66 29,360 1342 7.66
C# .NET 7.66 29,380 1424 7.66
Go #8 9.60 19,436 1224 9.62
spectral-norm
source secs mem gz cpu secs
* C# .NET #5 0.94 33,752 776 3.42
Go #8 5.33 19,416 429 5.34
Go 5.33 19,808 417 5.34
C# .NET #8 5.41 29,720 441 5.40
Go #2 1.50 19,808 674 5.68
Go #4 1.45 19,808 555 5.69
C# .NET #2 1.52 29,864 1084 5.78
C# .NET #3 1.54 31,460 890 5.80
mandelbrot
source secs mem gz cpu secs
* C# .NET #7 3.21 66,484 915 12.50
Go #4 3.76 35,456 912 14.99
Go #3 3.77 35,456 900 15.00
* C# .NET 3.93 64,440 1980 15.41
* C# .NET #9 3.93 64,332 822 15.45
C# .NET #5 4.06 63,344 851 15.87
Go 5.02 33,024 829 20.02
C# .NET #8 26.41 29,820 492 26.41
Go #8 26.68 19,440 500 26.74
C# .NET #3 6.79 61,964 722 26.79
Go #2 6.85 33,152 843 27.28
Go #6 6.89 33,024 707 27.44
C# .NET #2 46.19 29,604 504 46.19
fasta
source secs mem gz cpu secs
C# .NET #9 1.21 29,432 1512 1.21
Go 3.73 19,808 1055 3.74
Go #2 1.27 19,808 1405 4.06
Go #3 1.51 19,808 1362 4.09
C# .NET #8 5.40 32,864 904 5.42
C# .NET #5 1.48 50,620 1702 5.45
C# .NET 1.70 36,636 2113 6.23
Go #8 11.46 19,820 880 11.55
k-nucleotide
source secs mem gz cpu secs
C# .NET 3.18 181,724 2046 10.77
C# .NET #6 5.63 180,500 1615 14.88
Go #7 7.63 163,072 1613 28.79
Go #3 8.18 145,280 1729 29.88
Go #6 8.21 145,152 1596 30.01
Go #4 9.16 140,032 1552 31.38
C# .NET #4 12.06 612,408 1725 42.10
C# .NET #7 42.74 613,184 1449 43.35
Go #8 61.96 537,908 752 62.57
C# .NET #8 75.28 1,370,624 736 76.44
reverse-complement
source secs mem gz cpu secs
C# .NET #9 0.59 733,932 2641 1.37
Go #2 2.19 800,640 614 2.29
Go #3 2.48 800,384 609 2.57
C# .NET 3.14 583,252 1130 3.18
Go #6 1.91 1,244,508 1340 3.40
C# .NET #6 1.55 1,027,196 1627 3.76
C# .NET #5 2.53 1,025,008 1620 3.83
C# .NET #7 1.54 927,984 1312 4.25
C# .NET #3 8.47 1,380,908 934 13.21
Go #5   Bad Output  
Go   Failed  
binary-trees
source secs mem gz cpu secs
C# .NET #8 13.50 883,524 601 15.31
C# .NET #7 5.34 1,074,228 706 17.42
C# .NET #2 5.37 1,083,480 717 17.60
C# .NET 6.11 3,178,448 668 19.93
C# .NET #3 6.45 2,900,008 688 20.33
Go #6 27.90 404,096 618 29.26
Go #2 14.17 624,780 672 56.29
Go #3 14.91 326,508 806 58.00
Go #5 14.87 425,960 957 58.15
Go 32.01 243,192 488 59.78
Go #7 32.52 248,604 531 61.47
C# .NET #6   Make Error  
pidigits
source secs mem gz cpu secs
* C# .NET #6 0.82 30,744 1182 0.82
* Go #4 0.82 19,808 689 0.83
* C# .NET #5 0.84 33,264 990 0.88
Go 1.18 19,808 715 1.20
* C# .NET #4 1.29 31,392 1135 1.29
* Go #3 1.40 19,808 610 1.44
Go #2 1.84 19,808 740 1.89
Go #6 2.46 19,512 727 2.46
Go #7 4.99 19,808 702 5.61
C# .NET #7 7.15 38,160 579 7.25
regex-redux
source secs mem gz cpu secs
C# .NET #2 1.36 402,516 1881 2.60
C# .NET 4.60 599,212 641 4.83
C# .NET #5 1.74 614,536 679 5.02
Go #5 3.25 321,360 817 5.43
C# .NET #4 8.65 854,996 854 29.97
Go #4 14.61 369,008 832 35.91
Go 25.37 319,956 749 61.07
Go #3 25.62 371,204 836 61.79
C# .NET

.NET SDK 9.0.100
Host Version: 9.0.0
Commit: 9d5a6a9aa4

<OutputType>Exe
<TargetFramework>net9.0
<ImplicitUsings>enable
<Nullable>enable
<AllowUnsafeBlocks>true
<ServerGarbageCollection>true
<ConcurrentGarbageCollection>true
<PublishAot>false

Go

go version go1.23.1 linux/amd64
GOAMD64=v2