OCaml VS D benchmarks

Current benchmark data was generated on Thu May 04 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz (Model 85)

* -m in a file name stands for multi-threading or multi-processing

* -i in a file name stands for direct intrinsics usage. (Usage of simd intrinsics via libraries is not counted)

* -ffi in a file name stands for non-stdlib FFI usage

* (You may find time < time(user) + time(sys) for some non-parallelized programs, the overhead is from GC or JIT compiler, which are allowed to take advantage of multi-cores as that's more close to real-world scenarios.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 2543ms 10.0ms 312.3MB 2467ms 83ms ldc2 1.32.1
d 1.d 3482ms 11ms 314.1MB 3540ms 90ms dmd 2.103.1
ocaml 1.ml timeout 0.0ms 145.4MB 4903ms 73ms ocaml 5.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 264ms 2.3ms 208.9MB 210ms 40ms ldc2 1.32.1
d 1.d 332ms 1.7ms 210.5MB 263ms 47ms dmd 2.103.1
ocaml 1.ml 359ms 8.8ms 22.9MB 337ms 7ms ocaml 5.0.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1-im.d 658ms 7.5ms 1.5MB 1253ms 0ms ldc2 1.32.1
d 1-i.d 1291ms 2.0ms 1.6MB 1280ms 0ms ldc2 1.32.1
d 2-im.d 2612ms 31ms 1.5MB 5070ms 0ms ldc2 1.32.1
ocaml 2.ml 3637ms 2.2ms 2.7MB 3620ms 0ms ocaml 5.0.0
d 1.d 3877ms 10ms 1.5MB 3863ms 0ms ldc2 1.32.1
d 1.d 4782ms 2.5ms 2.8MB 4767ms 0ms dmd 2.103.1
d 1-i.d timeout 0.0ms 2.7MB 4983ms 0ms dmd 2.103.1
d 1-im.d timeout 0.0ms 4.8MB 9813ms 3ms dmd 2.103.1
d 2-i.d timeout 0.0ms 2.9MB 4983ms 0ms dmd 2.103.1
d 2-im.d timeout 0.0ms 2.9MB 9823ms 3ms dmd 2.103.1
d 2-i.d timeout 0.0ms 1.5MB 4990ms 0ms ldc2 1.32.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1-im.d 65ms 2.6ms 1.5MB 100ms 0ms ldc2 1.32.1
d 1-i.d 110ms 0.7ms 1.6MB 100ms 0ms ldc2 1.32.1
d 2-im.d 227ms 4.3ms 1.5MB 410ms 0ms ldc2 1.32.1
ocaml 2.ml 303ms 0.9ms 2.8MB 290ms 0ms ocaml 5.0.0
d 1.d 326ms 2.9ms 1.5MB 313ms 0ms ldc2 1.32.1
d 1.d 393ms 0.5ms 2.8MB 380ms 0ms dmd 2.103.1
d 2-i.d 417ms 0.9ms 1.5MB 407ms 0ms ldc2 1.32.1
d 1-im.d 458ms 4.1ms 4.6MB 870ms 0ms dmd 2.103.1
d 2-im.d 760ms 3.9ms 2.8MB 1443ms 3ms dmd 2.103.1
d 1-i.d 867ms 3.0ms 2.6MB 857ms 0ms dmd 2.103.1
d 2-i.d 1382ms 0.7ms 2.8MB 1370ms 0ms dmd 2.103.1

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 213ms 1.6ms 30.9MB 187ms 13ms ldc2 1.32.1
ocaml 6.ml 387ms 4.7ms 22.7MB 360ms 7ms ocaml 5.0.0
d 1.d 661ms 2.6ms 39.0MB 640ms 10ms dmd 2.103.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 27ms 3.1ms 7.0MB 20ms 0ms ldc2 1.32.1
ocaml 6.ml 42ms 0.4ms 4.9MB 30ms 0ms ocaml 5.0.0
d 1.d 70ms 0.9ms 11.7MB 50ms 3ms dmd 2.103.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 2.9ms 1.1ms 2.9MB 0ms 0ms ldc2 1.32.1
ocaml 1.ml 2.9ms 0.5ms 2.7MB 0ms 0ms ocaml 5.0.0
d 1.d 3.0ms 0.6ms 4.8MB 0ms 0ms dmd 2.103.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 172ms 1.7ms 4.1MB 160ms 0ms ldc2 1.32.1
ocaml 1.ml 250ms 4.9ms 6.7MB 240ms 0ms ocaml 5.0.0
d 1.d 256ms 0.9ms 5.6MB 250ms 0ms dmd 2.103.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 497ms 1.0ms 3.7MB 490ms 0ms ldc2 1.32.1
ocaml 1.ml 727ms 1.6ms 6.7MB 717ms 0ms ocaml 5.0.0
d 1.d 756ms 0.3ms 7.6MB 747ms 0ms dmd 2.103.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 74ms 1.1ms 3.8MB 63ms 0ms ldc2 1.32.1
ocaml 1.ml 110ms 0.4ms 6.0MB 93ms 0ms ocaml 5.0.0
d 1.d 112ms 0.1ms 5.8MB 103ms 0ms dmd 2.103.1

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 1473ms 0.7ms 312.7MB 1390ms 80ms ldc2 1.32.1
ocaml 1.ml 1931ms 14ms 69.1MB 1880ms 30ms ocaml 5.0.0
d 1.d 2312ms 50ms 314.2MB 2320ms 80ms dmd 2.103.1
ocaml 2.ml 3617ms 28ms 74.2MB 3557ms 43ms ocaml 5.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ocaml 1.ml 275ms 3.8ms 25.6MB 253ms 3ms ocaml 5.0.0
d 1.d 348ms 14ms 312.4MB 260ms 70ms ldc2 1.32.1
d 1.d 490ms 5.3ms 314.4MB 397ms 83ms dmd 2.103.1
ocaml 2.ml 629ms 19ms 30.1MB 610ms 7ms ocaml 5.0.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 456ms 8.0ms 1.5MB 443ms 0ms ldc2 1.32.1
d 2.d 484ms 0.9ms 1.6MB 470ms 0ms ldc2 1.32.1
ocaml 1.ml 546ms 8.2ms 2.9MB 533ms 0ms ocaml 5.0.0
d 1.d 1251ms 1.9ms 2.8MB 1240ms 0ms dmd 2.103.1
d 2.d 2175ms 2.8ms 2.9MB 2160ms 0ms dmd 2.103.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 49ms 0.7ms 1.6MB 40ms 0ms ldc2 1.32.1
d 2.d 51ms 0.9ms 1.6MB 40ms 0ms ldc2 1.32.1
ocaml 1.ml 59ms 0.7ms 2.8MB 50ms 0ms ocaml 5.0.0
d 1.d 130ms 2.4ms 2.8MB 120ms 0ms dmd 2.103.1
d 2.d 222ms 1.8ms 2.8MB 210ms 0ms dmd 2.103.1

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 2.d 869ms 1.6ms 47.9MB 837ms 13ms ldc2 1.32.1
d 1.d 1034ms 18ms 43.6MB 1007ms 10ms ldc2 1.32.1
d 1.d 1133ms 46ms 76.5MB 1107ms 7ms dmd 2.103.1
d 2.d 1531ms 1.7ms 49.5MB 1497ms 17ms dmd 2.103.1
ocaml 2.ml 2718ms 31ms 19.1MB 2703ms 0ms ocaml 5.0.0
ocaml 1.ml 3571ms 30ms 550.6MB 3400ms 157ms ocaml 5.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 131ms 3.4ms 14.0MB 113ms 3ms ldc2 1.32.1
d 1.d 139ms 1.8ms 24.4MB 117ms 7ms dmd 2.103.1
d 2.d 204ms 0.0ms 15.4MB 190ms 0ms ldc2 1.32.1
d 2.d 382ms 1.5ms 17.2MB 363ms 7ms dmd 2.103.1
ocaml 2.ml 640ms 4.4ms 9.3MB 627ms 0ms ocaml 5.0.0
ocaml 1.ml 763ms 24ms 140.2MB 713ms 30ms ocaml 5.0.0

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 3.d 764ms 1.2ms 171.9MB 923ms 70ms ldc2 1.32.1
d 3.d 1661ms 11ms 172.5MB 1843ms 63ms dmd 2.103.1
ocaml 2.ml timeout 0.0ms 181.9MB 4887ms 90ms ocaml 5.0.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 3.d 83ms 0.8ms 24.9MB 90ms 3ms ldc2 1.32.1
d 3.d 174ms 0.8ms 26.1MB 180ms 7ms dmd 2.103.1
ocaml 2.ml 715ms 2.6ms 52.5MB 673ms 27ms ocaml 5.0.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 3628ms 1.5ms 3.8MB 3613ms 0ms ldc2 1.32.1
d 1.d 4199ms 5.9ms 5.2MB 4183ms 0ms dmd 2.103.1
ocaml 2.ml timeout 0.0ms 4.2MB 4987ms 0ms ocaml 5.0.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 911ms 1.8ms 3.5MB 900ms 0ms ldc2 1.32.1
d 1.d 1048ms 0.1ms 5.0MB 1040ms 0ms dmd 2.103.1
ocaml 2.ml 1540ms 14ms 3.5MB 1527ms 0ms ocaml 5.0.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
d 1.d 231ms 1.3ms 3.0MB 220ms 0ms ldc2 1.32.1
d 1.d 266ms 0.9ms 4.7MB 250ms 0ms dmd 2.103.1
ocaml 2.ml 394ms 0.4ms 3.3MB 380ms 0ms ocaml 5.0.0