Odin VS Ruby benchmarks

Current benchmark data was generated on Fri May 20 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 2.1ms 1.0ms 0.9MB 0ms 0ms odin 2022
ruby 1.rb 39ms 1.0ms 134.6MB 20ms 18ms truffleruby 22.1.0
ruby 1.rb 72ms 1.1ms 30.1MB 50ms 10ms ruby 3.1.2
ruby 1.rb 225ms 0.8ms 286.6MB 72ms 138ms 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 176ms 1.5ms 1.8MB 160ms 0ms odin 2022
ruby 1.rb 617ms 3.7ms 286.7MB 477ms 120ms ruby/yjit 3.1.2
ruby 1.rb 623ms 13ms 30.2MB 603ms 3ms ruby 3.1.2
ruby 1-m.rb 913ms 8.6ms 326.3MB 1430ms 100ms truffleruby 22.1.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 517ms 3.6ms 1.8MB 503ms 0ms odin 2022
ruby 1.rb 1379ms 4.7ms 286.8MB 1223ms 140ms ruby/yjit 3.1.2
ruby 1-m.rb 1509ms 4.5ms 360.3MB 2183ms 140ms truffleruby 22.1.0
ruby 1.rb 1696ms 22ms 30.3MB 1667ms 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 82ms 0.2ms 0.8MB 70ms 0ms odin 2022
ruby 1.rb 343ms 4.0ms 30.0MB 313ms 13ms ruby 3.1.2
ruby 1.rb 419ms 0.9ms 286.7MB 277ms 130ms ruby/yjit 3.1.2
ruby 1-m.rb 680ms 65ms 309.9MB 1070ms 100ms truffleruby 22.1.0

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1615ms 0.8ms 4.7MB 1603ms 0ms odin 2022

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 69ms 0.3ms 0.8MB 60ms 0ms odin 2022

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 2.rb 1338ms 3.0ms 301.9MB 1703ms 93ms truffleruby 22.1.0
odin 1.odin 2543ms 1.4ms 0.8MB 2530ms 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 256ms 0.3ms 0.8MB 250ms 0ms odin 2022
ruby 2-m.rb 489ms 4.2ms 289.6MB 797ms 83ms truffleruby 22.1.0
ruby 2.rb 2366ms 7.0ms 286.8MB 2220ms 130ms ruby/yjit 3.1.2
ruby 2.rb 3241ms 11ms 30.0MB 3213ms 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 819ms 17ms 40.6MB 797ms 7ms odin 2022
odin 2.odin 1251ms 15ms 6.4MB 1240ms 0ms 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.1.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 122ms 0.2ms 11.4MB 110ms 0ms odin 2022
odin 2.odin 303ms 3.5ms 2.9MB 293ms 0ms odin 2022
ruby 1.rb 3510ms 27ms 408.6MB 3937ms 150ms truffleruby 22.1.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 4493ms 1.5ms 2.9MB 4480ms 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.1.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1128ms 0.4ms 2.4MB 1120ms 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.1.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 285ms 0.2ms 1.9MB 273ms 0ms odin 2022
ruby 4.rb 1862ms 8.4ms 436.8MB 2480ms 127ms truffleruby 22.1.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