The Computer Language
22.05 Benchmarks Game

Fastest cpu secs Haskell GHC versus OCaml

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
OCaml #3 13,992 1017 35.84
OCaml #4 19,812 1004 35.88
Haskell GHC #4 4,940 665 38.35
Haskell GHC #6 6,000 1113 40.52
Haskell GHC #5 6,196 842 40.82
OCaml #2 2,012 473 45.04
OCaml 2,036 524 52.69
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
OCaml 1,748 1251 6.91
Haskell GHC 6,136 1706 7.28
spectral-norm
source mem gz cpu
OCaml #2 3,932 377 5.32
Haskell GHC #2 7,592 403 5.33
Haskell GHC #4 4,536 987 5.69
mandelbrot
source mem gz cpu
Haskell GHC #3 51,516 1981 5.64
Haskell GHC #2 46,620 782 26.22
OCaml #6 3,252 444 28.23
OCaml 4,808 717 30.01
Haskell GHC 517,272 621 41.62
pidigits
source mem gz cpu
OCaml #7 6,260 593 0.74
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
OCaml #5 18,960 458 3.47
Haskell GHC #5 12,900 928 100.41
regex-redux
source mem gz cpu
Haskell GHC #3 403,240 2213 2.25
OCaml #3 525,884 647 4.18
OCaml #2 865,972 637 14.16
fasta
source mem gz cpu
Haskell GHC #4 41,512 2013 2.74
OCaml #6 203,384 1189 3.31
Haskell GHC #6 8,332 1882 3.31
OCaml #3 2,828 1071 4.65
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
Haskell GHC #3 537,888 2261 37.64
OCaml #3 255,644 1833 44.08
Haskell GHC 541,916 1059 81.88
Haskell GHC #2 694,340 1486 83.25
OCaml #2   Make Error  
OCaml   Make Error  
reverse-complement
source mem gz cpu
Haskell GHC #4 507,144 1041 3.51
OCaml 34,432 1368 4.61
Haskell GHC #2 3,531,324 998 6.44
OCaml #4   Make Error  
OCaml #3   Make Error  
OCaml #2   Make Error  
binary-trees
source mem gz cpu
OCaml #5 154,648 461 8.80
Haskell GHC #8 436,024 799 9.77
OCaml #2 135,536 751 10.65
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

OCaml

OCaml native-code
version 4.14.0