Haxe VS Ruby benchmarks

Current benchmark data was generated on Fri Dec 09 2022, 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
haxe 1.hx 1838ms 12ms 146.1MB 2247ms 73ms haxe/cpp 4.2.5
haxe 2.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.5
haxe 2.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.13.0
haxe 2.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.3
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.3
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.3.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 119ms 2.7ms 27.6MB 107ms 13ms haxe/cpp 4.2.5
haxe 2.hx 485ms 8.6ms 60.3MB 543ms 30ms haxe/cpp 4.2.5
haxe 1.hx 845ms 0.5ms 8.6MB 817ms 10ms haxe/hl/c 4.2.5
haxe 1.hx 982ms 4.8ms 11.0MB 940ms 20ms haxe/hl/jit 1.13.0
ruby 1.rb 1034ms 1.9ms 292.1MB 873ms 147ms ruby/yjit 3.1.3
ruby 1.rb 1057ms 6.6ms 35.5MB 1020ms 20ms ruby 3.1.3
ruby 1-m.rb 1147ms 21ms 428.0MB 1900ms 160ms truffleruby 22.3.0
haxe 2.hx 1306ms 4.5ms 13.4MB 1183ms 103ms haxe/hl/c 4.2.5
haxe 2.hx 1491ms 2.5ms 25.0MB 1353ms 117ms haxe/hl/jit 1.13.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 6-m.rb 2708ms 5.6ms 358.2MB 4840ms 303ms truffleruby 22.3.0
ruby 6.rb 2906ms 11ms 296.3MB 2740ms 150ms ruby/yjit 3.1.3
haxe 1.hx 3066ms 13ms 25.5MB 3033ms 220ms haxe/cpp 4.2.5
ruby 6.rb 4528ms 14ms 39.5MB 4490ms 20ms ruby 3.1.3
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.13.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 327ms 3.9ms 27.5MB 303ms 23ms haxe/cpp 4.2.5
ruby 6.rb 521ms 1.0ms 31.0MB 497ms 10ms ruby 3.1.3
ruby 6.rb 528ms 2.0ms 287.8MB 370ms 140ms ruby/yjit 3.1.3
haxe 1.hx 780ms 1.4ms 3.3MB 713ms 50ms haxe/hl/c 4.2.5
haxe 1.hx 829ms 2.2ms 3.7MB 773ms 37ms haxe/hl/jit 1.13.0
ruby 6-m.rb 856ms 16ms 320.0MB 1433ms 140ms truffleruby 22.3.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 2.7ms 0.5ms 3.2MB 0ms 0ms haxe/cpp 4.2.5
haxe 1.hx 2.9ms 0.9ms 2.4MB 0ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 4.2ms 0.7ms 3.2MB 0ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb 45ms 3.8ms 155.0MB 24ms 20ms truffleruby 22.3.0
ruby 1.rb 71ms 1.1ms 29.9MB 52ms 4ms ruby 3.1.3
ruby 1.rb 257ms 1.4ms 286.7MB 110ms 136ms ruby/yjit 3.1.3

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 188ms 0.8ms 22.2MB 177ms 0ms haxe/cpp 4.2.5
haxe 1.hx 212ms 3.8ms 2.9MB 197ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 231ms 2.9ms 3.7MB 220ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb 654ms 2.3ms 287.0MB 493ms 140ms ruby/yjit 3.1.3
ruby 1.rb 660ms 5.7ms 30.4MB 633ms 10ms ruby 3.1.3
ruby 1-m.rb 842ms 23ms 318.7MB 1243ms 100ms truffleruby 22.3.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 536ms 0.4ms 27.5MB 530ms 0ms haxe/cpp 4.2.5
haxe 1.hx 619ms 5.9ms 2.9MB 607ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 672ms 6.3ms 3.7MB 657ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb 1448ms 16ms 287.1MB 1273ms 157ms ruby/yjit 3.1.3
ruby 1.rb 1638ms 61ms 351.3MB 2137ms 137ms truffleruby 22.3.0
ruby 1.rb 1813ms 10.0ms 30.4MB 1783ms 17ms ruby 3.1.3

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 86ms 0.4ms 14.1MB 77ms 3ms haxe/cpp 4.2.5
haxe 1.hx 102ms 0.4ms 2.8MB 87ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 115ms 1.9ms 3.6MB 107ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb 362ms 1.3ms 30.4MB 333ms 13ms ruby 3.1.3
ruby 1.rb 456ms 3.7ms 287.0MB 300ms 140ms ruby/yjit 3.1.3
ruby 1-m.rb 640ms 19ms 309.0MB 933ms 120ms truffleruby 22.3.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 1279ms 5.0ms 97.1MB 1493ms 53ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.3
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.3
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.3.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 227ms 1.7ms 28.7MB 220ms 17ms haxe/cpp 4.2.5
haxe 1.hx 1668ms 12ms 10.9MB 1550ms 100ms haxe/hl/c 4.2.5
haxe 1.hx 1844ms 3.2ms 20.2MB 1733ms 93ms haxe/hl/jit 1.13.0
ruby 1-m.rb 3539ms 24ms 576.4MB 6470ms 250ms truffleruby 22.3.0
ruby 1.rb 3989ms 12ms 300.8MB 3823ms 153ms ruby/yjit 3.1.3
ruby 1.rb 4696ms 12ms 44.3MB 4667ms 13ms ruby 3.1.3

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 2.hx 1085ms 3.3ms 2.3MB 1073ms 0ms haxe/hl/c 4.2.5
ruby 2.rb 1219ms 32ms 305.7MB 1467ms 93ms truffleruby 22.3.0
haxe 3.hx 1457ms 4.7ms 27.6MB 1747ms 33ms haxe/cpp 4.2.5
haxe 1.hx 1489ms 39ms 2.3MB 1473ms 0ms haxe/hl/c 4.2.5
haxe 2.hx 2480ms 53ms 3.3MB 2467ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx 2670ms 60ms 3.2MB 2657ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/cpp 4.2.5
haxe 2.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/cpp 4.2.5
haxe 3.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.5
haxe 3.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.13.0
ruby 2.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.3
ruby 2.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.3

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 2.hx 112ms 0.6ms 2.4MB 100ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 150ms 0.7ms 2.3MB 140ms 0ms haxe/hl/c 4.2.5
haxe 3.hx 168ms 7.3ms 27.7MB 177ms 10ms haxe/cpp 4.2.5
haxe 2.hx 250ms 1.1ms 3.4MB 240ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx 272ms 6.4ms 3.2MB 263ms 0ms haxe/hl/jit 1.13.0
ruby 2-m.rb 447ms 28ms 316.0MB 653ms 127ms truffleruby 22.3.0
haxe 3.hx 700ms 12ms 3.2MB 630ms 57ms haxe/hl/c 4.2.5
haxe 3.hx 840ms 18ms 3.8MB 770ms 50ms haxe/hl/jit 1.13.0
haxe 2.hx 864ms 4.3ms 3.2MB 853ms 0ms haxe/cpp 4.2.5
haxe 1.hx 1050ms 15ms 3.2MB 1037ms 0ms haxe/cpp 4.2.5
ruby 2.rb 2409ms 3.5ms 286.9MB 2243ms 147ms ruby/yjit 3.1.3
ruby 2.rb 3443ms 15ms 30.0MB 3420ms 13ms ruby 3.1.3

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.13.0
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.3
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.3
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.3.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 1353ms 4.7ms 2.8MB 1340ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 2168ms 2.1ms 6.6MB 2153ms 0ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.13.0
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.3
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.3
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.3.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 341ms 0.4ms 2.9MB 330ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 548ms 1.3ms 5.3MB 537ms 0ms haxe/cpp 4.2.5
ruby 4.rb 2821ms 20ms 404.7MB 3360ms 157ms truffleruby 22.3.0
haxe 1.hx 2847ms 0.9ms 3.6MB 2830ms 0ms haxe/hl/jit 1.13.0
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.3
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.3