The Computer Language
25.03 Benchmarks Game

Go versus C# naot

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

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

fannkuch-redux      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* C# naot #5 2.16 8.58 6,713 1485 24.43
C# naot #2 31.30 31.29 6,001 584 23.80
* C# naot #9 8.11 32.35 6,377 1232 25.65
Go #3 8.36 33.35 3,846 975 5.31
C# naot #6 10.14 40.45—40.53 6,799 1075 24.13
C# naot #3 11.01 43.53—43.61 6,472 1117 23.77
C# naot #8 44.63 44.63 6,091 519 24.31
Go #8 46.15 46.26—46.33 3,207 500 5.43
Go 12.27 49.09 4,903 906 5.41
Go #2 12.36 49.40 16,966 903 5.43
n-body      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* C# naot #9 3.13 3.12 6,087 2480 24.34
* C# naot #4 3.70 3.70 6,078 2137 24.03
* C# naot #7 4.74 4.74 6,091 1715 23.78
* C# naot #6 4.77 3.92—6.97 6,115 1754 23.74
Go #3 6.39 6.41 3,191 1207 5.43
C# naot #3 6.67 6.65—6.70 6,095 1311 23.76
C# naot #2 6.81 6.81 5,898 1339 24.15
C# naot #8 7.02 7.01 5,833 1335 23.65
Go 7.02 7.09—7.27 3,228 1316 5.36
Go #2 7.04 7.06 3,203 1222 5.35
C# naot #0 7.46 7.46 6,107 1342 23.74
C# naot 7.46 7.45 6,124 1424 24.21
Go #8 9.60 9.64 3,191 1224 5.47
spectral-norm      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* C# naot #5 0.74 2.88 8,057 776 24.00
C# naot #8 5.35 5.34 6,820 441 24.29
Go #8 5.34 5.36 3,838 429 5.35
Go 5.34 5.36 4,059 417 5.35
Go #4 1.43 5.69 4,174 555 5.45
Go #2 1.51 5.70 4,317 674 5.56
C# naot #2 1.47 5.72 6,644 1084 24.38
C# naot #3 1.48 5.80 6,808 890 23.72
mandelbrot      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* C# naot #7 2.96 11.74 39,088 915 24.73
* C# naot #9 3.77 14.95 38,797 822 27.91
* C# naot 3.76 14.95 39,240 1980 24.86
Go #4 3.77 15.02 37,970 912 5.49
Go #3 3.78 15.03 38,101 900 5.82
C# naot #5 4.02 15.90 40,743 851 27.06
Go 5.04 20.05 35,787 829 5.40
C# naot #8 25.58 25.55—25.66 6,115 492 24.73
C# naot #3 6.69 26.53 39,715 722 24.95
Go #8 26.70 26.77 3,199 500 5.39
Go #2 6.87 27.32 35,549 843 5.69
Go #6 6.91 27.48 35,119 707 5.69
C# naot #2 47.60 47.84—48.30 6,148 504 24.02
fasta      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
C# naot #9 1.16 1.16 6,218 1512 24.53
Go 3.74 3.76 3,207 1055 5.36
Go #2 1.27 4.08 12,644 1405 5.51
Go #3 1.52 4.10 5,095 1362 5.29
C# naot #5 1.14 4.34—4.48 34,853 1702 24.14
C# naot 1.61 5.65—5.71 11,055 2113 24.61
C# naot #8 6.60 6.30 8,823 904 23.99
Go #8 11.22 11.54—11.80 9,052 880 5.55
k-nucleotide      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
C# naot 3.12 10.70—10.91 160,424 2046 27.36
C# naot #6 5.02 13.07—13.88 158,015 1615 26.90
Go #7 7.58 28.83—29.08 168,186 1613 5.42
Go #3 8.20 29.98—30.69 150,413 1729 5.63
Go #6 8.30 30.22—30.75 150,442 1596 5.79
Go #4 9.27 32.00—35.21 144,650 1552 5.11
C# naot #4 13.01 45.70—45.82 523,211 1725 27.45
C# naot #7 48.00 48.44—48.60 593,142 1449 23.68
Go #8 61.38 62.37—62.83 558,379 752 5.20
C# naot #8 83.91 75.78—77.28 1,354,269 736 24.68
reverse-complement      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Go #2 2.22 2.34—2.39 822,211 614 4.79
Go #3 2.50 2.62—2.66 821,985 609 4.88
C# naot 3.37 3.40—3.44 637,997 1130 24.13
Go #6 1.93 3.46—3.52 1,277,608 1340 4.77
C# naot #5 2.74 3.76 1,027,035 1620 24.63
C# naot #7 1.56 4.14—4.23 774,136 1312 23.76
C# naot #6 1.81 4.27—4.31 1,029,992 1627 24.50
C# naot #3 8.76 13.32—13.49 1,236,947 934 23.97
Go #5   Bad Output  
Go   Empty  
* C# naot #9   Bad Output  
binary-trees      [ Contentious. Different approaches. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
C# naot #7 6.22 17.09—17.67 1,115,476 706 23.97
C# naot #2 6.22 17.12—17.72 1,018,946 717 23.74
C# naot #3 6.71 18.09—18.62 2,829,128 688 23.94
C# naot 6.80 18.92—19.25 2,819,092 668 24.30
Go #6 27.93 29.32—29.66 416,195 618 5.43
Go #2 14.21 56.45—56.55 635,613 672 5.41
Go #3 14.90 57.97—58.17 329,499 806 5.29
Go #5 14.68 57.76—58.07 386,056 957 5.41
Go 32.05 59.81—60.00 243,114 488 5.21
Go #7 32.57 61.40—61.53 241,345 531 5.30
C# naot #6   Empty  
pidigits      [ Contentious. Different libraries. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* C# naot #6 0.75 0.75 7,905 1182 23.89
* Go #4 0.82 0.84 6,402 689 8.17
Go 1.15 1.22—1.31 7,533 715 11.71
* Go #3 1.17 1.35—1.49 6,885 610 8.50
Go #2 1.76 1.90—2.03 7,823 740 7.70
Go #6 2.47 2.48 10,703 727 5.59
* C# naot #4 4.54 4.53 8,053 1135 28.23
Go #7 5.00 5.65 10,527 702 6.17
C# naot #7 11.42 8.23—9.42 11,723 579 24.08
* C# naot #5 99.09 99.08—99.12 8,466 990 24.29
regex-redux      [ Contentious. Different libraries. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* C# naot #2 1.36 2.55 320,512 1881 25.36
Go #5 3.23 5.40—5.44 297,800 817 8.13
C# naot 10.69 10.70—10.79 582,550 641 27.07
C# naot #5 3.25 10.73—10.77 596,599 679 26.47
C# naot #4 9.81 32.95—33.06 743,510 854 26.94
Go #4 14.49 35.20—35.71 349,008 832 8.44
Go #3 25.15 61.72—63.46 336,585 836 5.60
Go 25.79 61.91—62.99 301,662 749 5.85
Go

go version go1.23.1 linux/amd64
GOAMD64=v2

C# naot

.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>true
<OptimizationPreference>Speed
<IlcInstructionSet>native