OCaml VS C# benchmarks

Current benchmark data was generated on Wed Feb 08 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8171M 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
csharp 1.cs 1718ms 34ms 303.4MB 1583ms 217ms dotnet/aot 7.0.102
csharp 1.cs 1977ms 81ms 433.3MB 1717ms 333ms dotnet 7.0.102
csharp 1.cs 2754ms 23ms 106.2MB 3340ms 227ms mono 6.12.0
ocaml 1.ml timeout 0.0ms 139.4MB 4927ms 50ms ocaml 5.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 173ms 7.2ms 60.2MB 137ms 30ms dotnet/aot 7.0.102
csharp 1.cs 190ms 1.8ms 46.1MB 167ms 13ms mono 6.12.0
csharp 1.cs 345ms 16ms 151.8MB 240ms 73ms dotnet 7.0.102
ocaml 1.ml 395ms 6.2ms 22.9MB 363ms 13ms ocaml 5.0.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ocaml 2.ml 4303ms 54ms 2.8MB 4290ms 0ms ocaml 5.0.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ocaml 2.ml 356ms 7.7ms 2.9MB 343ms 0ms ocaml 5.0.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5-m.cs 372ms 28ms 67.2MB 583ms 107ms dotnet/aot 7.0.102
ocaml 6.ml 450ms 2.9ms 22.7MB 433ms 3ms ocaml 5.0.0
csharp 5-m.cs 590ms 61ms 156.5MB 887ms 137ms dotnet 7.0.102
csharp 5-m.cs 645ms 15ms 60.3MB 1077ms 137ms mono 6.12.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ocaml 6.ml 50ms 0.4ms 4.9MB 37ms 0ms ocaml 5.0.0
csharp 5.cs 73ms 29ms 24.4MB 77ms 27ms dotnet/aot 7.0.102
csharp 5.cs 107ms 3.8ms 34.1MB 137ms 23ms mono 6.12.0
csharp 5.cs 163ms 6.8ms 111.5MB 130ms 70ms dotnet 7.0.102

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ocaml 1.ml 2.6ms 0.9ms 2.9MB 0ms 0ms ocaml 5.0.0
csharp 1.cs 8.0ms 0.9ms 10.1MB 0ms 0ms dotnet/aot 7.0.102
csharp 1.cs 24ms 1.3ms 23.6MB 10ms 2ms mono 6.12.0
csharp 1.cs 91ms 4.1ms 101.5MB 30ms 32ms dotnet 7.0.102

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 165ms 1.5ms 10.2MB 160ms 0ms dotnet/aot 7.0.102
csharp 2.cs 247ms 7.9ms 27.3MB 227ms 3ms mono 6.12.0
csharp 2.cs 272ms 2.4ms 102.2MB 213ms 27ms dotnet 7.0.102
ocaml 1.ml 290ms 2.9ms 6.7MB 277ms 0ms ocaml 5.0.0
csharp 1.cs 1879ms 12ms 56.1MB 1850ms 27ms dotnet/aot 7.0.102
csharp 1.cs 2048ms 2.1ms 145.7MB 1967ms 67ms dotnet 7.0.102
csharp 1.cs 4010ms 16ms 47.7MB 3953ms 50ms mono 6.12.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 492ms 13ms 10.1MB 483ms 0ms dotnet/aot 7.0.102
csharp 2.cs 535ms 11ms 101.9MB 483ms 30ms dotnet 7.0.102
csharp 2.cs 634ms 5.8ms 25.3MB 617ms 3ms mono 6.12.0
ocaml 1.ml 860ms 8.8ms 6.8MB 847ms 0ms ocaml 5.0.0
csharp 1.cs timeout 0.0ms 146.6MB 4930ms 57ms dotnet 7.0.102
csharp 1.cs timeout 0.0ms 56.4MB 4970ms 23ms dotnet/aot 7.0.102
csharp 1.cs timeout 0.0ms 47.9MB 4960ms 33ms mono 6.12.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 85ms 0.6ms 8.1MB 80ms 0ms dotnet/aot 7.0.102
ocaml 1.ml 130ms 0.3ms 5.9MB 120ms 0ms ocaml 5.0.0
csharp 2.cs 132ms 0.6ms 25.3MB 120ms 0ms mono 6.12.0
csharp 2.cs 190ms 5.7ms 102.2MB 127ms 30ms dotnet 7.0.102
csharp 1.cs timeout 0.0ms 137.6MB 4907ms 57ms dotnet 7.0.102
csharp 1.cs timeout 0.0ms 51.2MB 4953ms 40ms dotnet/aot 7.0.102
csharp 1.cs timeout 0.0ms 29.4MB 4967ms 0ms mono 6.12.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 1053ms 5.7ms 382.4MB 917ms 193ms dotnet/aot 7.0.102
csharp 1.cs 1147ms 32ms 303.2MB 1003ms 183ms dotnet/aot 7.0.102
csharp 2.cs 1283ms 16ms 497.2MB 1037ms 270ms dotnet 7.0.102
csharp 1.cs 1342ms 22ms 501.9MB 1127ms 263ms dotnet 7.0.102
ocaml 1.ml 2018ms 8.8ms 69.1MB 1967ms 33ms ocaml 5.0.0
csharp 1.cs 2174ms 53ms 142.9MB 2760ms 160ms mono 6.12.0
ocaml 2.ml 3866ms 14ms 74.3MB 3803ms 47ms ocaml 5.0.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 249ms 14ms 141.6MB 183ms 60ms dotnet/aot 7.0.102
ocaml 1.ml 296ms 3.1ms 25.8MB 263ms 10ms ocaml 5.0.0
csharp 1.cs 308ms 9.8ms 190.9MB 203ms 93ms dotnet/aot 7.0.102
csharp 1.cs 399ms 3.3ms 72.0MB 393ms 33ms mono 6.12.0
csharp 1.cs 444ms 10ms 249.0MB 327ms 103ms dotnet 7.0.102
csharp 2.cs 463ms 4.4ms 208.9MB 367ms 77ms dotnet 7.0.102
ocaml 2.ml 685ms 5.7ms 30.2MB 653ms 13ms ocaml 5.0.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 9.cs 531ms 2.8ms 98.0MB 463ms 33ms dotnet 7.0.102
ocaml 1.ml 668ms 18ms 2.9MB 653ms 0ms ocaml 5.0.0
csharp 8.cs 686ms 14ms 12.3MB 680ms 0ms dotnet/aot 7.0.102
csharp 8.cs 742ms 6.0ms 99.9MB 673ms 37ms dotnet 7.0.102
csharp 8.cs 1535ms 1.6ms 25.0MB 1513ms 3ms mono 6.12.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ocaml 1.ml 74ms 3.1ms 2.9MB 63ms 0ms ocaml 5.0.0
csharp 8.cs 78ms 3.2ms 10.0MB 73ms 0ms dotnet/aot 7.0.102
csharp 9.cs 144ms 2.8ms 98.4MB 83ms 33ms dotnet 7.0.102
csharp 8.cs 172ms 6.9ms 102.3MB 117ms 27ms dotnet 7.0.102
csharp 8.cs 181ms 0.8ms 25.0MB 157ms 3ms mono 6.12.0

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 2.cs 758ms 4.2ms 17.9MB 753ms 0ms dotnet/aot 7.0.102
csharp 2.cs 923ms 3.8ms 109.3MB 860ms 37ms dotnet 7.0.102
csharp 1.cs 1090ms 39ms 71.9MB 1063ms 20ms dotnet/aot 7.0.102
csharp 1.cs 1355ms 47ms 82.5MB 1317ms 23ms mono 6.12.0
csharp 1.cs 1931ms 106ms 158.9MB 1843ms 53ms dotnet 7.0.102
ocaml 1.ml 2737ms 6.5ms 550.4MB 2570ms 153ms ocaml 5.0.0
ocaml 2.ml 3263ms 200ms 19.0MB 3240ms 7ms ocaml 5.0.0
csharp 2.cs 3286ms 22ms 31.9MB 3267ms 7ms mono 6.12.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 1.cs 174ms 11ms 30.5MB 153ms 13ms dotnet/aot 7.0.102
csharp 2.cs 189ms 9.5ms 11.4MB 173ms 0ms dotnet/aot 7.0.102
csharp 1.cs 225ms 4.3ms 40.6MB 200ms 7ms mono 6.12.0
csharp 2.cs 290ms 2.2ms 104.8MB 233ms 23ms dotnet 7.0.102
csharp 1.cs 405ms 14ms 114.9MB 337ms 33ms dotnet 7.0.102
ocaml 1.ml 557ms 15ms 140.2MB 507ms 33ms ocaml 5.0.0
csharp 2.cs 805ms 2.3ms 26.1MB 787ms 3ms mono 6.12.0
ocaml 2.ml 811ms 68ms 9.1MB 797ms 0ms ocaml 5.0.0

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 5.cs 3780ms 13ms 600.5MB 3770ms 253ms dotnet 7.0.102
csharp 6.cs 4186ms 22ms 591.0MB 4060ms 253ms dotnet 7.0.102
csharp 6.cs 4329ms 8.4ms 504.8MB 4173ms 210ms dotnet/aot 7.0.102
csharp 5.cs timeout 0.0ms 185.8MB 4950ms 103ms dotnet/aot 7.0.102
ocaml 2.ml timeout 0.0ms 125.5MB 4923ms 50ms ocaml 5.0.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 6.cs 461ms 10ms 73.9MB 433ms 27ms dotnet/aot 7.0.102
csharp 5.cs 575ms 9.7ms 168.1MB 487ms 70ms dotnet 7.0.102
csharp 6.cs 669ms 16ms 163.9MB 573ms 70ms dotnet 7.0.102
ocaml 2.ml 818ms 6.0ms 52.5MB 780ms 20ms ocaml 5.0.0
csharp 5.cs 841ms 9.2ms 72.1MB 797ms 43ms dotnet/aot 7.0.102

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 2549ms 81ms 13.6MB 4870ms 13ms dotnet/aot 7.0.102
csharp 3-m.cs 4653ms 9.5ms 106.8MB 8870ms 43ms dotnet 7.0.102
csharp 3.cs timeout 0.0ms 27.1MB 9733ms 10ms mono 6.12.0
ocaml 2.ml timeout 0.0ms 4.0MB 4983ms 0ms ocaml 5.0.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 649ms 1.7ms 12.2MB 1230ms 0ms dotnet/aot 7.0.102
csharp 3-m.cs 1335ms 16ms 104.6MB 2427ms 30ms dotnet 7.0.102
ocaml 2.ml 1802ms 7.5ms 3.6MB 1787ms 0ms ocaml 5.0.0
csharp 3-m.cs 3239ms 166ms 29.5MB 6070ms 7ms mono 6.12.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
csharp 3-m.cs 186ms 7.1ms 12.2MB 320ms 3ms dotnet/aot 7.0.102
csharp 3-m.cs 440ms 7.6ms 104.3MB 670ms 33ms dotnet 7.0.102
ocaml 2.ml 475ms 16ms 3.4MB 460ms 0ms ocaml 5.0.0
csharp 3-m.cs 820ms 6.1ms 29.6MB 1540ms 0ms mono 6.12.0