Haxe VS Ruby benchmarks

Current benchmark data was generated on Wed Mar 22 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz (Model 106)

* -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 1764ms 25ms 146.1MB 2053ms 70ms haxe/cpp 4.2.5
haxe 2.hx 4752ms 37ms 495.1MB 5953ms 257ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 48.6MB 4677ms 307ms haxe/hl/c 4.2.5
haxe 2.hx timeout 0.0ms 83.0MB 4393ms 590ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 49.0MB 4730ms 257ms haxe/hl/jit 1.13.0
haxe 2.hx timeout 0.0ms 130.2MB 4407ms 573ms haxe/hl/jit 1.13.0
ruby 1.rb timeout 0.0ms 72.7MB 4940ms 43ms ruby 3.2.1
ruby 1.rb timeout 0.0ms 115.6MB 4920ms 60ms ruby/yjit 3.2.1
ruby 1.rb timeout 0.0ms 714.3MB 7813ms 353ms truffleruby 22.3.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 124ms 2.7ms 27.5MB 120ms 7ms haxe/cpp 4.2.5
haxe 2.hx 458ms 12ms 60.3MB 510ms 33ms haxe/cpp 4.2.5
ruby 1.rb 551ms 1.5ms 40.6MB 523ms 10ms ruby/yjit 3.2.1
haxe 1.hx 831ms 3.7ms 8.5MB 790ms 20ms haxe/hl/c 4.2.5
ruby 1.rb 991ms 4.0ms 40.2MB 963ms 10ms ruby 3.2.1
ruby 1-m.rb 1011ms 11ms 430.3MB 1650ms 120ms truffleruby 22.3.1
haxe 1.hx 1085ms 6.4ms 11.1MB 1020ms 50ms haxe/hl/jit 1.13.0
haxe 2.hx 1339ms 26ms 13.5MB 1180ms 140ms haxe/hl/c 4.2.5
haxe 2.hx 1599ms 11ms 25.0MB 1400ms 180ms 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.rb 2407ms 2.4ms 43.5MB 2377ms 13ms ruby/yjit 3.2.1
ruby 6-m.rb 2592ms 11ms 372.7MB 4680ms 257ms truffleruby 22.3.1
haxe 1.hx 3404ms 7.7ms 27.5MB 3340ms 233ms haxe/cpp 4.2.5
ruby 6.rb 4226ms 15ms 43.1MB 4197ms 13ms ruby 3.2.1
haxe 1.hx timeout 0.0ms 3.4MB 4660ms 323ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 3.7MB 4710ms 270ms haxe/hl/jit 1.13.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 6.rb 316ms 0.2ms 35.0MB 283ms 17ms ruby/yjit 3.2.1
haxe 1.hx 359ms 0.7ms 27.5MB 330ms 30ms haxe/cpp 4.2.5
ruby 6.rb 497ms 11ms 34.4MB 470ms 10ms ruby 3.2.1
haxe 1.hx 820ms 3.0ms 3.2MB 760ms 43ms haxe/hl/c 4.2.5
ruby 6-m.rb 833ms 25ms 321.3MB 1410ms 120ms truffleruby 22.3.1
haxe 1.hx 871ms 1.2ms 3.6MB 810ms 40ms haxe/hl/jit 1.13.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 2.3ms 0.4ms 2.3MB 0ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 2.8ms 0.4ms 3.2MB 0ms 0ms haxe/cpp 4.2.5
haxe 1.hx 5.0ms 1.0ms 3.2MB 0ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb 44ms 1.8ms 156.9MB 16ms 30ms truffleruby 22.3.1
ruby 1.rb 74ms 1.5ms 32.0MB 52ms 10ms ruby 3.2.1
ruby 1.rb 75ms 0.7ms 32.1MB 50ms 10ms ruby/yjit 3.2.1

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 191ms 5.0ms 22.3MB 170ms 0ms haxe/cpp 4.2.5
haxe 1.hx 195ms 1.5ms 2.8MB 180ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 235ms 0.8ms 3.6MB 220ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb 440ms 1.3ms 32.9MB 417ms 7ms ruby/yjit 3.2.1
ruby 1.rb 600ms 6.0ms 32.4MB 573ms 10ms ruby 3.2.1
ruby 1-m.rb 787ms 25ms 323.1MB 1143ms 103ms truffleruby 22.3.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 517ms 0.2ms 27.4MB 493ms 17ms haxe/cpp 4.2.5
haxe 1.hx 571ms 0.7ms 2.9MB 560ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 717ms 8.0ms 3.7MB 703ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb 1169ms 4.7ms 33.0MB 1143ms 7ms ruby/yjit 3.2.1
ruby 1.rb 1441ms 41ms 371.3MB 1893ms 140ms truffleruby 22.3.1
ruby 1.rb 1641ms 7.3ms 32.4MB 1613ms 17ms ruby 3.2.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 87ms 1.9ms 14.1MB 77ms 0ms haxe/cpp 4.2.5
haxe 1.hx 96ms 2.0ms 2.8MB 83ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 118ms 0.9ms 3.6MB 110ms 0ms haxe/hl/jit 1.13.0
ruby 1.rb 256ms 0.7ms 32.8MB 237ms 3ms ruby/yjit 3.2.1
ruby 1.rb 333ms 3.6ms 32.3MB 313ms 7ms ruby 3.2.1
ruby 1-m.rb 569ms 14ms 309.1MB 853ms 77ms truffleruby 22.3.1

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 1192ms 2.8ms 97.0MB 1373ms 50ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 32.7MB 4637ms 347ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 54.5MB 4637ms 343ms haxe/hl/jit 1.13.0
ruby 1.rb timeout 0.0ms 96.5MB 4927ms 53ms ruby 3.2.1
ruby 1.rb timeout 0.0ms 97.0MB 4940ms 40ms ruby/yjit 3.2.1
ruby 1.rb timeout 0.0ms 567.8MB 9107ms 270ms truffleruby 22.3.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 241ms 2.7ms 28.5MB 243ms 10ms haxe/cpp 4.2.5
haxe 1.hx 1629ms 18ms 10.9MB 1470ms 143ms haxe/hl/c 4.2.5
haxe 1.hx 1898ms 1.2ms 20.2MB 1757ms 123ms haxe/hl/jit 1.13.0
ruby 1-m.rb 3328ms 33ms 590.4MB 6060ms 243ms truffleruby 22.3.1
ruby 1.rb 4322ms 23ms 53.7MB 4287ms 20ms ruby/yjit 3.2.1
ruby 1.rb timeout 0.0ms 52.7MB 4960ms 20ms ruby 3.2.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 2.hx 980ms 11ms 2.4MB 970ms 0ms haxe/hl/c 4.2.5
ruby 2.rb 1041ms 6.3ms 305.3MB 1223ms 103ms truffleruby 22.3.1
haxe 1.hx 1334ms 50ms 2.3MB 1323ms 0ms haxe/hl/c 4.2.5
haxe 3.hx 1418ms 5.0ms 27.6MB 1763ms 30ms haxe/cpp 4.2.5
haxe 2.hx 2306ms 2.5ms 3.2MB 2297ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx 2514ms 2.3ms 3.3MB 2500ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx timeout 0.0ms 3.2MB 4987ms 0ms haxe/cpp 4.2.5
haxe 2.hx timeout 0.0ms 3.2MB 4983ms 0ms haxe/cpp 4.2.5
haxe 3.hx timeout 0.0ms 3.3MB 4507ms 477ms haxe/hl/c 4.2.5
haxe 3.hx timeout 0.0ms 3.7MB 4620ms 363ms haxe/hl/jit 1.13.0
ruby 2.rb timeout 0.0ms 32.2MB 4970ms 13ms ruby 3.2.1
ruby 2.rb timeout 0.0ms 33.0MB 4977ms 3ms ruby/yjit 3.2.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 2.hx 101ms 1.2ms 2.4MB 90ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 127ms 0.6ms 2.3MB 117ms 0ms haxe/hl/c 4.2.5
haxe 3.hx 160ms 3.3ms 25.6MB 177ms 7ms haxe/cpp 4.2.5
haxe 2.hx 241ms 10ms 3.3MB 230ms 0ms haxe/hl/jit 1.13.0
haxe 1.hx 264ms 11ms 3.1MB 253ms 0ms haxe/hl/jit 1.13.0
ruby 2-m.rb 403ms 15ms 307.3MB 623ms 83ms truffleruby 22.3.1
haxe 3.hx 640ms 8.2ms 3.2MB 573ms 50ms haxe/hl/c 4.2.5
haxe 3.hx 787ms 6.7ms 3.7MB 737ms 30ms haxe/hl/jit 1.13.0
haxe 2.hx 854ms 2.3ms 3.2MB 843ms 0ms haxe/cpp 4.2.5
haxe 1.hx 1045ms 1.9ms 3.2MB 1033ms 0ms haxe/cpp 4.2.5
ruby 2.rb 2132ms 5.5ms 32.9MB 2103ms 13ms ruby/yjit 3.2.1
ruby 2.rb 3199ms 11ms 32.2MB 3180ms 3ms ruby 3.2.1

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx timeout 0.0ms 6.9MB 4980ms 0ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 3.0MB 4983ms 0ms haxe/hl/c 4.2.5
haxe 1.hx timeout 0.0ms 3.7MB 4987ms 0ms haxe/hl/jit 1.13.0
ruby 4.rb timeout 0.0ms 32.3MB 4970ms 10ms ruby 3.2.1
ruby 4.rb timeout 0.0ms 32.6MB 4970ms 13ms ruby/yjit 3.2.1
ruby 4.rb timeout 0.0ms 551.6MB 5220ms 233ms truffleruby 22.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 1307ms 1.2ms 2.9MB 1283ms 3ms haxe/hl/c 4.2.5
haxe 1.hx 2344ms 1.2ms 6.6MB 2330ms 0ms haxe/cpp 4.2.5
haxe 1.hx timeout 0.0ms 3.6MB 4987ms 0ms haxe/hl/jit 1.13.0
ruby 4.rb timeout 0.0ms 32.3MB 4973ms 7ms ruby 3.2.1
ruby 4.rb timeout 0.0ms 32.7MB 4970ms 7ms ruby/yjit 3.2.1
ruby 4.rb timeout 0.0ms 589.4MB 5457ms 193ms truffleruby 22.3.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 331ms 0.1ms 2.8MB 317ms 0ms haxe/hl/c 4.2.5
haxe 1.hx 593ms 1.8ms 5.4MB 577ms 0ms haxe/cpp 4.2.5
ruby 4.rb 2499ms 6.6ms 470.4MB 2993ms 157ms truffleruby 22.3.1
haxe 1.hx 3428ms 0.2ms 3.6MB 3413ms 0ms haxe/hl/jit 1.13.0
ruby 4.rb timeout 0.0ms 32.3MB 4967ms 10ms ruby 3.2.1
ruby 4.rb timeout 0.0ms 33.0MB 4963ms 17ms ruby/yjit 3.2.1