The Computer Language
24.09 Benchmarks Game

Java 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
Go #3 8.34 19,808 975 33.31
Java 10.04 42,708 1289 39.47
Java #3 40.81 42,920 1264 40.91
Java #2 44.33 41,012 520 44.38
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 #5 6.79 41,476 1435 6.83
Java #4 6.91 41,364 1495 6.95
Go 7.01 19,808 1316 7.03
Go #2 7.03 19,808 1222 7.05
Java #2 7.58 41,440 1430 7.62
Java #3 7.63 41,352 1436 7.67
Java 7.89 41,616 1437 7.93
spectral-norm
source secs mem gz cpu secs
Go 5.33 19,808 417 5.34
Go #2 1.50 19,808 674 5.68
Go #4 1.45 19,808 555 5.69
Java #3 1.69 43,028 762 6.41
Java 7.08 42,384 521 7.14
Java #2 2.44 42,180 956 9.47
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.14 81,668 802 16.25
Java #4 4.44 104,696 667 16.25
Java #6 4.31 81,888 808 16.97
Go 5.02 33,024 829 20.02
Java 25.75 41,428 671 25.81
Go #2 6.85 33,152 843 27.28
Go #6 6.89 33,024 707 27.44
Java #3 7.42 81,216 910 29.33
pidigits
source secs mem gz cpu secs
Go #4 0.82 19,808 689 0.83
Java #3 0.94 40,944 770 0.96
Go 1.18 19,808 715 1.20
Java #2 1.35 44,528 944 1.42
Go #3 1.40 19,808 610 1.44
Go #2 1.84 19,808 740 1.89
Go #8 2.46 19,808 727 2.47
Go #7 4.99 19,808 702 5.61
Java 7.63 491,600 807 8.66
regex-redux
source secs mem gz cpu secs
Java #8 1.62 372,312 2201 3.20
Go #5 3.25 321,360 817 5.43
Java 8.58 586,528 875 16.95
Java #6 5.59 1,235,356 746 17.14
Java #3 5.25 629,428 935 17.37
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
fasta
source secs mem gz cpu secs
Java #4 3.16 42,812 1528 3.27
Java #6 1.18 48,364 2549 3.74
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.26 48,824 2478 4.17
Java #2 4.39 47,624 1259 4.56
k-nucleotide
source secs mem gz cpu secs
Java 5.02 369,032 1821 16.31
Java #3 7.26 365,384 1642 25.09
Java #6 7.26 365,680 1614 25.28
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.70 195,564 1887 35.08
Java #5 20.44 218,932 2225 44.56
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.40 2,031,576 760 4.06
Java #5 4.78 1,096,264 1115 4.92
Java #4 5.59 1,890,020 656 5.71
Java #7 23.61 1,036,152 1654 6.24
Go #5   Bad Output  
Go   Failed  
Java #3   Bad Output  
Java #8   Bad Output  
binary-trees
source secs mem gz cpu secs
Java #4 4.46 1,957,564 846 5.19
Java #3 4.90 2,032,184 546 5.67
Java #6 5.02 2,065,280 535 5.79
Java #2 5.11 2,064,188 558 5.83
Java #7 2.59 1,718,620 841 8.08
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
Java

java 22 2024-03-19
Java HotSpot(TM) 64-Bit Server VM
(build 22+36-2370,
mixed mode, sharing)

Go

go version go1.23.1 linux/amd64
GOAMD64=v2