The Computer Language
22.05 Benchmarks Game

Fastest cpu secs Go versus Java

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 cpu seconds, less gz source code.

fannkuch-redux
source mem gz cpu
Go #3 2,260 969 32.88
Java #3 35,324 1257 41.17
Java 35,824 1282 41.74
Java #2 34,244 514 44.98
Go 2,956 900 47.36
Go #2 11,316 896 47.56
n-body
source mem gz cpu
Go #3 1,136 1200 6.38
Go 1,136 1310 6.58
Java #5 34,252 1429 6.79
Java #4 34,076 1489 6.79
Go #2 1,132 1215 6.94
Java #3 34,612 1430 7.50
Java #2 34,704 1424 7.50
Java 37,380 1430 7.83
spectral-norm
source mem gz cpu
Go 2,452 411 5.33
Go #4 1,952 548 5.67
Go #2 1,420 668 5.68
Java #3 38,428 756 5.94
Java 37,288 514 9.76
Java #2 37,368 950 10.07
mandelbrot
source mem gz cpu
Go #4 33,812 905 14.85
Go #3 34,028 894 14.91
Java #4 66,304 660 16.16
Java #2 68,860 796 16.21
Java #6 67,432 802 16.92
Go 32,600 823 19.58
Go #2 33,196 837 27.07
Go #6 32,764 700 27.25
Java 34,252 665 27.75
Java #3 69,200 903 29.18
pidigits
source mem gz cpu
Java #3 35,700 764 0.82
Go #4 8,732 683 0.87
Go #3 9,320 603 1.18
Go 9,496 708 1.21
Java #2 38,328 938 1.53
Go #2 9,032 733 1.59
Go #8 9,924 720 2.54
Go #7 8,620 696 5.05
Java 513,728 800 8.94
regex-redux
source mem gz cpu
Go #5 306,476 810 5.97
Java 924,116 868 17.12
Java #6 728,332 740 17.16
Java #3 741,028 929 17.34
Go #4 355,844 829 34.99
Go #3 358,472 829 67.28
Go 297,048 741 68.45
fasta
source mem gz cpu
Java #4 36,800 1524 3.41
Java #6 42,416 2543 3.52
Go 1,112 1053 3.64
Go #2 10,980 1404 3.84
Go #3 3,168 1358 3.98
Java #5 42,532 2473 4.14
Java #2 36,812 1257 4.46
k-nucleotide
source mem gz cpu
Java 349,544 1812 16.17
Java #6 343,684 1607 25.67
Java #3 344,652 1635 25.73
Go #7 159,432 1607 28.49
Go #6 149,712 1590 29.40
Go #4 144,528 1543 30.22
Go #3 149,984 1722 30.25
Java #4 199,824 1882 37.48
Java #5 210,368 2219 43.27
reverse-complement
source mem gz cpu
Go #2 826,796 611 1.94
Go #3 826,544 605 2.13
Go #5 1,483,756 996 2.26
Go #6 1,289,572 1338 2.48
Java #8 665,804 2183 3.49
Java #6 2,024,016 752 4.15
Java #5 1,088,392 1108 4.92
Java #3 1,170,232 1722 5.09
Java #4 1,881,900 651 5.41
Java #7 1,030,892 1647 23.16
Go   Failed  
binary-trees
source mem gz cpu
Java #3 2,106,820 540 5.19
Java #6 2,093,916 529 5.35
Java #4 2,079,388 840 5.44
Java #2 1,877,464 552 5.45
Java #7 2,460,388 835 7.73
Go #6 411,424 611 29.23
Go #2 632,396 666 48.67
Go #3 328,700 799 50.09
Go #5 394,800 950 50.52
Go 240,292 482 51.02
Go #7 259,088 525 51.41
Go

go version go1.18 linux/amd64

Java

openjdk 18 2022-03-22
OpenJDK Runtime Environment
(build 18+36-2087)
OpenJDK 64-Bit Server VM
(build 18+36-2087,
mixed mode, sharing)