Odin VS Ruby benchmarks

Current benchmark data was generated on Sun Jan 29 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
odin 1.odin 4186ms 20ms 49.5MB 4153ms 17ms odin 2023
ruby 1.rb timeout 0.0ms 72.6MB 4967ms 17ms ruby 3.2.0
ruby 1.rb timeout 0.0ms 115.6MB 4940ms 40ms ruby/yjit 3.2.0
ruby 1.rb timeout 0.0ms 757.2MB 7747ms 373ms truffleruby 22.3.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 383ms 0.8ms 7.4MB 370ms 0ms odin 2023
ruby 1.rb 535ms 0.7ms 40.7MB 513ms 7ms ruby/yjit 3.2.0
ruby 1-m.rb 965ms 36ms 426.1MB 1560ms 130ms truffleruby 22.3.1
ruby 1.rb 983ms 12ms 40.3MB 947ms 17ms ruby 3.2.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1.6ms 0.6ms 1.3MB 0ms 0ms odin 2023
ruby 1.rb 41ms 2.6ms 156.3MB 16ms 26ms truffleruby 22.3.1
ruby 1.rb 72ms 0.3ms 32.5MB 46ms 14ms ruby/yjit 3.2.0
ruby 1.rb 72ms 0.5ms 32.1MB 48ms 12ms ruby 3.2.0

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1-m.odin 845ms 5.5ms 46.0MB 1473ms 43ms odin 2023

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 171ms 7.2ms 31.7MB 227ms 20ms odin 2023

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 270ms 1.5ms 1.3MB 260ms 0ms odin 2023
ruby 1.rb 445ms 3.9ms 33.0MB 423ms 7ms ruby/yjit 3.2.0
ruby 1.rb 602ms 5.2ms 32.4MB 573ms 13ms ruby 3.2.0
ruby 1-m.rb 753ms 19ms 323.9MB 1107ms 97ms truffleruby 22.3.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 815ms 2.7ms 1.2MB 810ms 0ms odin 2023
ruby 1.rb 1174ms 2.2ms 32.9MB 1153ms 10ms ruby/yjit 3.2.0
ruby 1.rb 1398ms 49ms 364.8MB 1797ms 137ms truffleruby 22.3.1
ruby 1.rb 1668ms 32ms 32.4MB 1640ms 13ms ruby 3.2.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 113ms 2.0ms 1.3MB 103ms 0ms odin 2023
ruby 1.rb 258ms 2.3ms 32.9MB 233ms 10ms ruby/yjit 3.2.0
ruby 1.rb 335ms 5.5ms 32.3MB 310ms 7ms ruby 3.2.0
ruby 1-m.rb 565ms 51ms 309.0MB 860ms 87ms truffleruby 22.3.1

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1586ms 3.3ms 4.5MB 1573ms 0ms odin 2023

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 95ms 46ms 1.3MB 83ms 0ms odin 2023

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1-i.odin 533ms 6.0ms 1.2MB 523ms 0ms odin 2023
ruby 2.rb 1013ms 1.8ms 306.6MB 1220ms 67ms truffleruby 22.3.1
odin 1.odin 2879ms 0.3ms 1.3MB 2870ms 0ms odin 2023
ruby 2.rb timeout 0.0ms 32.2MB 4973ms 10ms ruby 3.2.0
ruby 2.rb timeout 0.0ms 33.0MB 4967ms 17ms ruby/yjit 3.2.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1-i.odin 55ms 0.6ms 1.3MB 43ms 0ms odin 2023
odin 1.odin 292ms 3.4ms 1.2MB 280ms 0ms odin 2023
ruby 2-m.rb 380ms 2.8ms 305.0MB 580ms 73ms truffleruby 22.3.1
ruby 2.rb 2169ms 0.8ms 33.0MB 2140ms 10ms ruby/yjit 3.2.0
ruby 2.rb 3369ms 22ms 32.2MB 3340ms 13ms ruby 3.2.0

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 600ms 8.2ms 40.6MB 573ms 10ms odin 2023
odin 2.odin 1181ms 0.7ms 6.4MB 1167ms 0ms odin 2023
ruby 1.rb timeout 0.0ms 344.6MB 4850ms 123ms ruby 3.2.0
ruby 1.rb timeout 0.0ms 345.1MB 4833ms 143ms ruby/yjit 3.2.0
ruby 1.rb timeout 0.0ms 689.3MB 5030ms 153ms truffleruby 22.3.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 123ms 3.7ms 11.4MB 107ms 0ms odin 2023
odin 2.odin 290ms 3.0ms 2.6MB 280ms 0ms odin 2023
ruby 1.rb 2733ms 12ms 428.6MB 3227ms 123ms truffleruby 22.3.1
ruby 1.rb timeout 0.0ms 151.1MB 4910ms 70ms ruby 3.2.0
ruby 1.rb timeout 0.0ms 151.5MB 4910ms 70ms ruby/yjit 3.2.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 4617ms 1.1ms 2.9MB 4607ms 0ms odin 2023
ruby 4.rb timeout 0.0ms 32.2MB 4977ms 7ms ruby 3.2.0
ruby 4.rb timeout 0.0ms 32.8MB 4973ms 10ms ruby/yjit 3.2.0
ruby 4.rb timeout 0.0ms 585.6MB 5217ms 223ms truffleruby 22.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1157ms 0.7ms 2.1MB 1147ms 0ms odin 2023
ruby 4.rb timeout 0.0ms 32.1MB 4970ms 10ms ruby 3.2.0
ruby 4.rb timeout 0.0ms 32.8MB 4973ms 10ms ruby/yjit 3.2.0
ruby 4.rb timeout 0.0ms 580.5MB 5417ms 200ms truffleruby 22.3.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 291ms 0.4ms 1.8MB 280ms 0ms odin 2023
ruby 4.rb 2454ms 2.0ms 479.2MB 2940ms 143ms truffleruby 22.3.1
ruby 4.rb timeout 0.0ms 32.4MB 4970ms 7ms ruby 3.2.0
ruby 4.rb timeout 0.0ms 32.8MB 4967ms 13ms ruby/yjit 3.2.0