Odin VS Ruby benchmarks

Current benchmark data was generated on Mon Jun 23 2025, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][4 cores] AMD EPYC 7763 64-Core Processor (Model 1)

* -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 2344ms 32ms 49.5MB 2310ms 17ms odin 2024
ruby 1.rb 4905ms 47ms 110.1MB 4803ms 87ms ruby/yjit 3.4.4
ruby 1.rb timeout 0.0ms 70.5MB 4950ms 37ms ruby 3.4.4
ruby 1.rb timeout 0.0ms 757.2MB 6760ms 690ms truffleruby 24.2.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 218ms 1.9ms 7.5MB 207ms 0ms odin 2024
ruby 1.rb 500ms 4.2ms 20.3MB 477ms 10ms ruby/yjit 3.4.4
ruby 1-m.rb 571ms 43ms 418.8MB 1113ms 167ms truffleruby 24.2.1
ruby 1.rb 948ms 9.8ms 19.5MB 927ms 10ms ruby 3.4.4

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1.1ms 0.0ms 1.6MB 0ms 0ms odin 2024
ruby 1.rb 36ms 0.9ms 141.8MB 12ms 30ms truffleruby 24.2.1
ruby 1.rb 51ms 1.3ms 12.8MB 40ms 0ms ruby 3.4.4
ruby 1.rb 54ms 1.3ms 12.9MB 40ms 4ms ruby/yjit 3.4.4

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 148ms 2.9ms 1.6MB 140ms 0ms odin 2024
ruby 1.rb 342ms 2.7ms 13.5MB 323ms 7ms ruby/yjit 3.4.4
ruby 1.rb 530ms 6.8ms 12.9MB 513ms 3ms ruby 3.4.4
ruby 1-m.rb 675ms 36ms 370.2MB 1157ms 147ms truffleruby 24.2.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 439ms 2.8ms 1.6MB 430ms 0ms odin 2024
ruby 1.rb 908ms 1.9ms 13.5MB 887ms 10ms ruby/yjit 3.4.4
ruby 1-m.rb 1250ms 4.8ms 410.5MB 1783ms 160ms truffleruby 24.2.1
ruby 1.rb 1469ms 7.6ms 12.8MB 1453ms 7ms ruby 3.4.4

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 68ms 1.3ms 1.6MB 60ms 0ms odin 2024
ruby 1.rb 202ms 6.0ms 13.5MB 183ms 7ms ruby/yjit 3.4.4
ruby 1.rb 289ms 3.4ms 12.8MB 273ms 3ms ruby 3.4.4
ruby 1-m.rb 537ms 6.4ms 359.2MB 1050ms 143ms truffleruby 24.2.1

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 288ms 4.8ms 4.6MB 280ms 0ms odin 2024

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 14ms 0.2ms 1.6MB 10ms 0ms odin 2024

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 356ms 2.5ms 1.5MB 347ms 0ms odin 2024
odin 1-i.odin 358ms 0.4ms 1.5MB 350ms 0ms odin 2024
ruby 2.rb 831ms 18ms 310.8MB 1067ms 110ms truffleruby 24.2.1
ruby 2.rb timeout 0.0ms 12.8MB 4983ms 0ms ruby 3.4.4
ruby 2.rb timeout 0.0ms 13.5MB 4980ms 7ms ruby/yjit 3.4.4

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1-i.odin 38ms 0.7ms 1.5MB 30ms 0ms odin 2024
odin 1.odin 38ms 0.4ms 1.5MB 30ms 0ms odin 2024
ruby 2-m.rb 310ms 3.7ms 323.2MB 563ms 110ms truffleruby 24.2.1
ruby 2.rb 1029ms 3.6ms 13.5MB 1017ms 0ms ruby/yjit 3.4.4
ruby 2.rb 2937ms 80ms 12.8MB 2920ms 3ms ruby 3.4.4

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 278ms 6.7ms 40.7MB 263ms 0ms odin 2024
odin 2.odin 700ms 31ms 6.5MB 687ms 0ms odin 2024
ruby 1.rb timeout 0.0ms 325.3MB 4850ms 137ms ruby 3.4.4
ruby 1.rb timeout 0.0ms 327.0MB 4840ms 140ms ruby/yjit 3.4.4
ruby 1.rb timeout 0.0ms 726.3MB 5057ms 167ms truffleruby 24.2.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 55ms 3.9ms 11.3MB 43ms 0ms odin 2024
odin 2.odin 178ms 6.0ms 2.8MB 167ms 0ms odin 2024
ruby 1-m.rb 1705ms 21ms 478.0MB 2453ms 170ms truffleruby 24.2.1
ruby 1.rb 4023ms 798ms 131.8MB 3930ms 73ms ruby/yjit 3.4.4
ruby 1.rb 4558ms 108ms 131.0MB 4463ms 80ms ruby 3.4.4

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 3604ms 7.2ms 2.9MB 3597ms 0ms odin 2024
ruby 4.rb timeout 0.0ms 12.9MB 4983ms 3ms ruby 3.4.4
ruby 4.rb timeout 0.0ms 13.5MB 4983ms 3ms ruby/yjit 3.4.4
ruby 4.rb timeout 0.0ms 444.0MB 5170ms 240ms truffleruby 24.2.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 904ms 0.9ms 2.3MB 890ms 0ms odin 2024
ruby 4.rb 4929ms 35ms 450.6MB 5243ms 210ms truffleruby 24.2.1
ruby 4.rb timeout 0.0ms 12.9MB 4980ms 3ms ruby 3.4.4
ruby 4.rb timeout 0.0ms 13.5MB 4987ms 0ms ruby/yjit 3.4.4

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 228ms 1.5ms 1.9MB 220ms 0ms odin 2024
ruby 4.rb 1454ms 17ms 382.2MB 1783ms 143ms truffleruby 24.2.1
ruby 4.rb timeout 0.0ms 12.9MB 4980ms 3ms ruby 3.4.4
ruby 4.rb timeout 0.0ms 13.6MB 4980ms 0ms ruby/yjit 3.4.4