Haxe VS Ruby benchmarks

Current benchmark data was generated on Fri Jul 01 2022, 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
haxe 1.hx 2253ms 31ms 146.0MB 2823ms 87ms haxe/cpp 4.2.4
haxe 2.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/cpp 4.2.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.4
haxe 2.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.12.0
haxe 2.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.12.0
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 152ms 2.8ms 27.4MB 153ms 17ms haxe/cpp 4.2.4
haxe 2.hx 613ms 4.9ms 60.2MB 770ms 27ms haxe/cpp 4.2.4
haxe 1.hx 1094ms 16ms 7.8MB 1047ms 27ms haxe/hl/c 4.2.4
ruby 1.rb 1274ms 11ms 292.1MB 1093ms 163ms ruby/yjit 3.1.2
ruby 1-m.rb 1306ms 48ms 383.1MB 2173ms 163ms truffleruby 22.1.0
ruby 1.rb 1342ms 20ms 35.5MB 1297ms 27ms ruby 3.1.2
haxe 1.hx 1364ms 18ms 11.2MB 1287ms 60ms haxe/hl/jit 1.12.0
haxe 2.hx 1782ms 12ms 13.5MB 1620ms 140ms haxe/hl/c 4.2.4
haxe 2.hx 2205ms 13ms 24.7MB 2010ms 180ms haxe/hl/jit 1.12.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 6.rb 3568ms 38ms 295.9MB 3367ms 180ms ruby/yjit 3.1.2
haxe 1.hx 3855ms 29ms 27.6MB 3967ms 293ms haxe/cpp 4.2.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.12.0
ruby 6.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.2
ruby 6.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 405ms 4.4ms 27.3MB 383ms 37ms haxe/cpp 4.2.4
ruby 6.rb 626ms 0.5ms 31.2MB 590ms 17ms ruby 3.1.2
ruby 6.rb 652ms 6.3ms 287.7MB 460ms 173ms ruby/yjit 3.1.2
haxe 1.hx 1015ms 12ms 3.3MB 910ms 87ms haxe/hl/c 4.2.4
haxe 1.hx 1055ms 0.4ms 3.9MB 983ms 50ms haxe/hl/jit 1.12.0
ruby 6-m.rb 2027ms 16ms 365.4MB 3610ms 177ms truffleruby 22.1.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 2.9ms 0.6ms 2.6MB 0ms 0ms haxe/hl/c 4.2.4
haxe 1.hx 3.3ms 0.7ms 4.4MB 0ms 0ms haxe/cpp 4.2.4
haxe 1.hx 5.1ms 0.9ms 3.4MB 0ms 0ms haxe/hl/jit 1.12.0
ruby 1.rb 55ms 2.2ms 136.6MB 30ms 26ms truffleruby 22.1.0
ruby 1.rb 89ms 3.9ms 30.0MB 62ms 12ms ruby 3.1.2
ruby 1.rb 301ms 1.0ms 286.7MB 124ms 160ms ruby/yjit 3.1.2

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 228ms 0.7ms 22.1MB 203ms 7ms haxe/cpp 4.2.4
haxe 1.hx 262ms 2.8ms 3.0MB 247ms 0ms haxe/hl/c 4.2.4
haxe 1.hx 303ms 9.3ms 3.6MB 287ms 0ms haxe/hl/jit 1.12.0
ruby 1.rb 810ms 13ms 286.7MB 630ms 163ms ruby/yjit 3.1.2
ruby 1.rb 852ms 8.9ms 30.2MB 820ms 13ms ruby 3.1.2
ruby 1-m.rb 1307ms 11ms 317.4MB 1973ms 170ms truffleruby 22.1.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 657ms 8.7ms 27.4MB 650ms 10ms haxe/cpp 4.2.4
haxe 1.hx 786ms 8.0ms 3.0MB 770ms 0ms haxe/hl/c 4.2.4
haxe 1.hx 898ms 4.3ms 3.7MB 883ms 0ms haxe/hl/jit 1.12.0
ruby 1.rb 1782ms 19ms 286.7MB 1617ms 150ms ruby/yjit 3.1.2
ruby 1-m.rb 2298ms 34ms 349.9MB 3253ms 277ms truffleruby 22.1.0
ruby 1.rb 2334ms 9.9ms 30.2MB 2310ms 10ms ruby 3.1.2

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 104ms 0.2ms 14.3MB 90ms 0ms haxe/cpp 4.2.4
haxe 1.hx 133ms 1.9ms 2.8MB 120ms 0ms haxe/hl/c 4.2.4
haxe 1.hx 145ms 0.8ms 3.7MB 133ms 0ms haxe/hl/jit 1.12.0
ruby 1.rb 461ms 5.8ms 29.9MB 430ms 17ms ruby 3.1.2
ruby 1.rb 555ms 6.4ms 286.7MB 387ms 150ms ruby/yjit 3.1.2
ruby 1-m.rb 976ms 49ms 307.6MB 1510ms 160ms truffleruby 22.1.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 1520ms 20ms 99.0MB 1820ms 63ms haxe/cpp 4.2.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.12.0
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 307ms 4.5ms 28.6MB 320ms 13ms haxe/cpp 4.2.4
haxe 1.hx 2311ms 24ms 15.5MB 2190ms 107ms haxe/hl/c 4.2.4
haxe 1.hx 2608ms 15ms 20.3MB 2443ms 147ms haxe/hl/jit 1.12.0
ruby 1-m.rb 4441ms 29ms 575.8MB 8110ms 297ms truffleruby 22.1.0
ruby 1.rb 4986ms 21ms 300.9MB 4793ms 173ms ruby/yjit 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 2.hx 1338ms 16ms 2.5MB 1327ms 0ms haxe/hl/c 4.2.4
haxe 1.hx 1784ms 37ms 2.6MB 1770ms 0ms haxe/hl/c 4.2.4
ruby 2.rb 1848ms 68ms 303.0MB 2323ms 130ms truffleruby 22.1.0
haxe 3.hx 2667ms 9.8ms 27.6MB 3237ms 47ms haxe/cpp 4.2.4
haxe 2.hx 3143ms 96ms 3.7MB 3133ms 0ms haxe/hl/jit 1.12.0
haxe 1.hx 3257ms 40ms 3.3MB 3243ms 0ms haxe/hl/jit 1.12.0
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/cpp 4.2.4
haxe 2.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/cpp 4.2.4
haxe 3.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.4
haxe 3.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.12.0
ruby 2.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.2
ruby 2.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.2

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 2.hx 139ms 2.9ms 2.6MB 127ms 0ms haxe/hl/c 4.2.4
haxe 1.hx 181ms 3.8ms 2.6MB 170ms 0ms haxe/hl/c 4.2.4
haxe 3.hx 290ms 4.1ms 27.6MB 323ms 10ms haxe/cpp 4.2.4
haxe 2.hx 313ms 8.8ms 3.3MB 300ms 0ms haxe/hl/jit 1.12.0
haxe 1.hx 332ms 12ms 3.3MB 320ms 0ms haxe/hl/jit 1.12.0
ruby 2-m.rb 649ms 21ms 296.6MB 1040ms 123ms truffleruby 22.1.0
haxe 3.hx 939ms 18ms 3.1MB 853ms 67ms haxe/hl/c 4.2.4
haxe 2.hx 1032ms 11ms 4.4MB 1017ms 0ms haxe/cpp 4.2.4
haxe 3.hx 1108ms 13ms 3.8MB 1033ms 53ms haxe/hl/jit 1.12.0
haxe 1.hx 1326ms 13ms 3.2MB 1313ms 0ms haxe/cpp 4.2.4
ruby 2.rb 2927ms 33ms 286.8MB 2737ms 177ms ruby/yjit 3.1.2
ruby 2.rb 3978ms 23ms 30.0MB 3947ms 17ms ruby 3.1.2

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.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/c 4.2.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.12.0
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.2
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.2
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 2385ms 5.4ms 6.6MB 2370ms 0ms haxe/cpp 4.2.4
haxe 1.hx 2393ms 12ms 3.3MB 2373ms 3ms haxe/hl/c 4.2.4
haxe 1.hx timeout 0.0ms 0.0MB 0ms 0ms haxe/hl/jit 1.12.0
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.2
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.2
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
haxe 1.hx 601ms 2.1ms 5.2MB 583ms 0ms haxe/cpp 4.2.4
haxe 1.hx 612ms 10.0ms 3.0MB 600ms 0ms haxe/hl/c 4.2.4
ruby 4.rb 2919ms 42ms 352.5MB 3707ms 203ms truffleruby 22.1.0
haxe 1.hx 3493ms 26ms 3.7MB 3480ms 0ms haxe/hl/jit 1.12.0
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby 3.1.2
ruby 4.rb timeout 0.0ms 0.0MB 0ms 0ms ruby/yjit 3.1.2