The Computer Language
24.11 Benchmarks Game

Go versus Java 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
Go #3 8.34 19,808 975 33.31
Java #3 39.96 44,308 1264 40.06
Java 10.85 44,612 1289 42.80
Java #2 45.77 42,552 520 45.83
Java #8 45.90 42,568 517 45.97
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
Go #3 6.38 19,808 1207 6.40
Java #4 6.88 42,028 1495 6.91
Go 7.01 19,808 1316 7.03
Go #2 7.03 19,808 1222 7.05
Java #5 7.30 43,424 1435 7.36
Java #2 7.48 42,260 1430 7.52
Java #3 7.49 42,292 1436 7.52
Java #8 7.59 42,924 1322 7.64
Java 7.84 42,652 1437 7.88
Go #8 9.60 19,436 1224 9.62
spectral-norm
source secs mem gz cpu secs
Go #8 5.33 19,416 429 5.34
Go 5.33 19,808 417 5.34
Java #8 5.43 43,368 453 5.49
Go #2 1.50 19,808 674 5.68
Go #4 1.45 19,808 555 5.69
Java #3 1.57 44,160 762 5.93
Java #2 1.61 43,028 956 6.08
mandelbrot
source secs mem gz cpu secs
Go #4 3.76 35,456 912 14.99
Go #3 3.77 35,456 900 15.00
Java #2 4.08 82,216 802 16.06
Java #4 4.41 105,000 667 16.14
Java #6 4.19 82,232 808 16.42
Go 5.02 33,024 829 20.02
Java 24.50 42,272 671 24.57
Go #8 26.68 19,440 500 26.74
Go #2 6.85 33,152 843 27.28
Go #6 6.89 33,024 707 27.44
Java #3 6.96 82,972 910 27.54
Java #8 27.67 45,844 441 27.79
fasta
source secs mem gz cpu secs
Java #4 3.28 44,352 1528 3.40
Java #6 1.16 49,848 2549 3.71
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
Java #5 1.24 49,640 2478 4.13
Java #2 4.45 48,896 1259 4.60
Java #8 15.11 77,032 894 15.49
Go #8 18.27 19,440 838 18.46
k-nucleotide
source secs mem gz cpu secs
Java 4.92 427,448 1821 15.77
Java #6 7.27 426,032 1614 25.17
Java #3 7.34 426,540 1642 25.47
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
Java #4 34.33 197,748 1887 34.67
Java #5 22.10 222,396 2225 48.14
Java #8 78.46 2,083,000 786 80.86
reverse-complement
source secs mem gz cpu secs
Go #2 2.19 800,640 614 2.29
Go #3 2.48 800,384 609 2.57
Go #6 1.91 1,244,508 1340 3.40
Java #6 3.15 2,032,996 760 3.79
Java #5 4.72 1,097,732 1115 4.84
Java #4 5.65 1,891,656 656 5.77
Java #7 23.98 1,037,708 1654 6.26
Go #5   Bad Output  
Go   Failed  
Java #3   Bad Output  
binary-trees
source secs mem gz cpu secs
Java #4 4.41 1,821,244 846 5.14
Java #6 4.87 1,782,568 535 5.63
Java #3 4.85 1,769,500 546 5.65
Java #2 5.09 1,820,068 558 5.83
Java #8 6.57 1,767,108 596 7.29
Java #7 2.62 1,803,192 841 8.14
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
pidigits
source secs mem gz cpu secs
* Java #3 0.80 41,900 770 0.83
* Go #4 0.82 19,808 689 0.83
Go 1.18 19,808 715 1.20
* Java #2 1.29 45,768 944 1.37
* 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
Java 7.68 482,056 807 8.75
regex-redux
source secs mem gz cpu secs
Java #2 1.55 372,764 2201 3.16
Go #5 3.25 321,360 817 5.43
Java 8.47 575,552 875 16.69
Java #6 5.60 1,237,440 746 17.12
Java #3 5.25 611,476 935 17.25
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
Go

go version go1.23.1 linux/amd64
GOAMD64=v2

Java

java 23 2024-09-17
Java HotSpot(TM) 64-Bit Server VM
(build 23+37-2369,
mixed mode, sharing)