The Computer Language
22.05 Benchmarks Game

Fastest cpu secs Haskell GHC 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
Haskell GHC #4 4,940 665 38.35
Haskell GHC #6 6,000 1113 40.52
Haskell GHC #5 6,196 842 40.82
Java #3 35,324 1257 41.17
Java 35,824 1282 41.74
Java #2 34,244 514 44.98
Haskell GHC #2 25,896 808 129.64
Haskell GHC 10,224 559 317.32
Haskell GHC #3   Make Error  
n-body
source mem gz cpu
Haskell GHC #2 6,140 1883 6.61
Java #5 34,252 1429 6.79
Java #4 34,076 1489 6.79
Haskell GHC 6,136 1706 7.28
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
Haskell GHC #2 7,592 403 5.33
Haskell GHC #4 4,536 987 5.69
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
Haskell GHC #3 51,516 1981 5.64
Java #4 66,304 660 16.16
Java #2 68,860 796 16.21
Java #6 67,432 802 16.92
Haskell GHC #2 46,620 782 26.22
Java 34,252 665 27.75
Java #3 69,200 903 29.18
Haskell GHC 517,272 621 41.62
pidigits
source mem gz cpu
Java #3 35,700 764 0.82
Java #2 38,328 938 1.53
Haskell GHC #6 17,832 360 1.71
Haskell GHC #4 17,796 348 1.95
Haskell GHC #2 17,916 585 2.36
Haskell GHC #3 17,796 379 2.37
Haskell GHC 18,092 460 2.40
Java 513,728 800 8.94
Haskell GHC #5 12,900 928 100.41
regex-redux
source mem gz cpu
Haskell GHC #3 403,240 2213 2.25
Java 924,116 868 17.12
Java #6 728,332 740 17.16
Java #3 741,028 929 17.34
fasta
source mem gz cpu
Haskell GHC #4 41,512 2013 2.74
Haskell GHC #6 8,332 1882 3.31
Java #4 36,800 1524 3.41
Java #6 42,416 2543 3.52
Java #5 42,532 2473 4.14
Java #2 36,812 1257 4.46
Haskell GHC #2 431,104 1319 16.27
Haskell GHC #5   Make Error  
Haskell GHC   Make Error  
Haskell GHC #3   Make Error  
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
Java #4 199,824 1882 37.48
Haskell GHC #3 537,888 2261 37.64
Java #5 210,368 2219 43.27
Haskell GHC 541,916 1059 81.88
Haskell GHC #2 694,340 1486 83.25
reverse-complement
source mem gz cpu
Java #8 665,804 2183 3.49
Haskell GHC #4 507,144 1041 3.51
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
Haskell GHC #2 3,531,324 998 6.44
Java #7 1,030,892 1647 23.16
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
Haskell GHC #8 436,024 799 9.77
Haskell GHC #7 549,592 811 11.30
Haskell GHC #6 454,300 592 11.52
Haskell GHC #2 440,892 491 13.54
Haskell GHC 683,156 494 15.26
Haskell GHC #5 681,832 561 15.65
Haskell GHC #3 683,828 538 16.02
Haskell GHC

The Glorious Glasgow Haskell
Compilation System,
version 9.2.1

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)