Odin VS Ruby benchmarks

Current benchmark data was generated on Thu Sep 22 2022, 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.)

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1.7ms 0.5ms 0.9MB 0ms 0ms odin 2022
ruby 1.rb 41ms 1.1ms 145.7MB 22ms 16ms truffleruby 22.2.0
ruby 1.rb 70ms 0.9ms 29.9MB 48ms 10ms ruby 3.1.2
ruby 1.rb 240ms 1.6ms 286.6MB 100ms 124ms ruby/yjit 3.1.2

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 182ms 0.8ms 1.9MB 170ms 0ms odin 2022
ruby 1.rb 609ms 6.2ms 30.2MB 580ms 10ms ruby 3.1.2
ruby 1.rb 627ms 4.1ms 286.6MB 487ms 127ms ruby/yjit 3.1.2
ruby 1-m.rb 746ms 6.4ms 314.0MB 1080ms 93ms truffleruby 22.2.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 545ms 3.0ms 1.9MB 530ms 0ms odin 2022
ruby 1.rb 1388ms 18ms 286.8MB 1247ms 127ms ruby/yjit 3.1.2
ruby 1.rb 1391ms 3.8ms 339.8MB 1920ms 120ms truffleruby 22.2.0
ruby 1.rb 1675ms 30ms 30.2MB 1650ms 13ms ruby 3.1.2

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 85ms 2.6ms 0.9MB 73ms 0ms odin 2022
ruby 1.rb 347ms 5.8ms 29.9MB 327ms 7ms ruby 3.1.2
ruby 1.rb 433ms 1.2ms 286.7MB 290ms 127ms ruby/yjit 3.1.2
ruby 1-m.rb 538ms 7.6ms 297.4MB 823ms 73ms truffleruby 22.2.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 2.rb 1108ms 5.4ms 317.8MB 1390ms 100ms truffleruby 22.2.0
odin 1.odin 2502ms 1.7ms 0.9MB 2490ms 0ms odin 2022
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
odin 1.odin 253ms 0.8ms 0.9MB 240ms 0ms odin 2022
ruby 2-m.rb 421ms 1.4ms 300.5MB 650ms 100ms truffleruby 22.2.0
ruby 2.rb 2353ms 2.0ms 286.7MB 2207ms 123ms ruby/yjit 3.1.2
ruby 2.rb 3241ms 15ms 29.9MB 3217ms 10ms ruby 3.1.2

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 726ms 24ms 40.6MB 700ms 10ms odin 2022
odin 2.odin 1160ms 1.8ms 6.3MB 1143ms 3ms odin 2022
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.2.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 122ms 0.6ms 11.4MB 110ms 0ms odin 2022
odin 2.odin 283ms 0.6ms 2.8MB 270ms 0ms odin 2022
ruby 1.rb 3198ms 35ms 463.2MB 3600ms 157ms truffleruby 22.2.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

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 4618ms 1.5ms 2.9MB 4607ms 0ms odin 2022
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.2.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1158ms 0.3ms 2.3MB 1147ms 0ms odin 2022
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.2.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 294ms 3.8ms 1.9MB 280ms 0ms odin 2022
ruby 4.rb 2456ms 33ms 462.5MB 2987ms 150ms truffleruby 22.2.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