The Computer Language
24.11 Benchmarks Game

C# .NET versus Java GraalVM 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
* C# .NET #9 8.40 29,608 1232 33.33
Java GraalVM #3 34.03 90,752 1264 34.21
Java GraalVM 9.33 91,152 1289 36.72
Java GraalVM #2 38.48 91,636 520 38.63
C# .NET #6 9.93 29,272 1075 39.49
Java GraalVM #8 42.18 91,368 517 42.35
C# .NET #3 11.01 29,020 1117 43.46
C# .NET #8 43.80 28,760 519 43.78
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
Java GraalVM #4 6.22 90,128 1495 6.36
Java GraalVM #5 6.47 90,344 1435 6.61
C# .NET #3 6.65 29,280 1311 6.64
C# .NET #2 6.89 29,284 1339 6.89
Java GraalVM #3 6.89 89,592 1436 7.03
Java GraalVM #2 6.90 89,600 1430 7.03
C# .NET #8 7.21 29,068 1335 7.21
Java GraalVM #8 7.11 88,832 1322 7.24
Java GraalVM 7.31 89,724 1437 7.44
C# .NET #0 7.66 29,360 1342 7.66
C# .NET 7.66 29,380 1424 7.66
spectral-norm
source secs mem gz cpu secs
* C# .NET #5 0.94 33,752 776 3.42
C# .NET #8 5.41 29,720 441 5.40
C# .NET #2 1.52 29,864 1084 5.78
C# .NET #3 1.54 31,460 890 5.80
Java GraalVM #3 1.64 92,416 762 6.14
Java GraalVM #2 1.80 92,800 956 6.83
Java GraalVM #8 11.19 91,648 453 11.38
mandelbrot
source secs mem gz cpu secs
* C# .NET #7 3.21 66,484 915 12.50
* 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
Java GraalVM #4 4.37 138,740 667 16.04
Java GraalVM #2 4.14 132,372 802 16.30
Java GraalVM #6 4.16 129,024 808 16.36
C# .NET #8 26.41 29,820 492 26.41
Java GraalVM 26.60 90,356 671 26.78
C# .NET #3 6.79 61,964 722 26.79
Java GraalVM #3 7.27 127,788 910 28.79
Java GraalVM #8 29.95 93,304 441 30.20
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
Java GraalVM #6 1.28 99,840 2549 3.66
Java GraalVM #5 1.27 97,536 2478 3.75
Java GraalVM #4 3.55 142,080 1528 4.56
C# .NET #8 5.40 32,864 904 5.42
C# .NET #5 1.48 50,620 1702 5.45
Java GraalVM #2 4.63 142,480 1259 5.61
C# .NET 1.70 36,636 2113 6.23
Java GraalVM #8 9.75 181,036 894 10.30
k-nucleotide
source secs mem gz cpu secs
C# .NET 3.18 181,724 2046 10.77
Java GraalVM 4.31 475,296 1821 13.63
C# .NET #6 5.63 180,500 1615 14.88
Java GraalVM #6 7.69 471,456 1614 27.24
Java GraalVM #3 7.79 472,096 1642 27.63
Java GraalVM #4 33.45 239,724 1887 34.10
Java GraalVM #5 15.99 248,224 2225 38.12
C# .NET #4 12.06 612,408 1725 42.10
C# .NET #7 42.74 613,184 1449 43.35
C# .NET #8 75.50 1,371,044 736 76.56
Java GraalVM #8 84.32 1,586,392 786 87.17
reverse-complement
source secs mem gz cpu secs
C# .NET #9 0.59 733,932 2641 1.37
C# .NET 3.14 583,252 1130 3.18
C# .NET #6 1.55 1,027,196 1627 3.76
C# .NET #5 2.53 1,025,008 1620 3.83
Java GraalVM #6 3.44 2,080,968 760 4.23
C# .NET #7 1.54 927,984 1312 4.25
Java GraalVM #5 4.95 1,145,720 1115 5.31
Java GraalVM #4 5.69 1,906,560 656 5.99
Java GraalVM #7 24.65 1,180,012 1654 12.56
C# .NET #3 8.47 1,380,908 934 13.21
Java GraalVM #3   Bad Output  
binary-trees
source secs mem gz cpu secs
Java GraalVM #2 5.11 1,948,200 558 6.99
Java GraalVM #4 5.42 1,815,132 846 7.22
Java GraalVM #6 6.00 1,794,592 535 7.91
Java GraalVM #3 5.95 1,880,164 546 8.60
Java GraalVM #7 2.81 1,850,008 841 8.76
Java GraalVM #8 7.19 1,757,812 596 9.15
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
C# .NET #6   Make Error  
pidigits
source secs mem gz cpu secs
* C# .NET #6 0.82 30,744 1182 0.82
* C# .NET #5 0.84 33,264 990 0.88
Java GraalVM #3 0.84 87,552 770 0.96
* C# .NET #4 1.29 31,392 1135 1.29
Java GraalVM #2 1.34 96,384 944 1.53
C# .NET #7 7.15 38,160 579 7.25
Java GraalVM 7.08 528,896 807 8.13
regex-redux
source secs mem gz cpu secs
C# .NET #2 1.36 402,516 1881 2.60
Java GraalVM #2 1.56 408,236 2201 3.36
C# .NET 4.60 599,212 641 4.83
C# .NET #5 1.74 614,536 679 5.02
Java GraalVM 7.95 617,884 875 15.48
Java GraalVM #3 4.93 646,312 935 16.03
Java GraalVM #6 5.21 1,281,824 746 16.40
C# .NET #4 8.65 854,996 854 29.97
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

Java GraalVM

openjdk 23 2024-09-17
Java HotSpot(TM) 64-Bit Server VM
OpenJDK GraalVM CE
(build 23+37-jvmci-b01,
mixed mode, sharing)