Odin VS Ruby benchmarks

Current benchmark data was generated on Thu May 01 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 2300ms 35ms 49.5MB 2267ms 17ms odin 2024
ruby 1.rb 4679ms 84ms 150.6MB 4570ms 97ms ruby/yjit 3.4.3
ruby 1.rb timeout 0.0ms 70.0MB 4950ms 40ms ruby 3.4.3
ruby 1.rb timeout 0.0ms 780.8MB 6557ms 723ms truffleruby 24.2.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 219ms 3.5ms 7.5MB 207ms 0ms odin 2024
ruby 1.rb 481ms 3.0ms 20.3MB 460ms 10ms ruby/yjit 3.4.3
ruby 1-m.rb 537ms 62ms 414.1MB 1070ms 150ms truffleruby 24.2.1
ruby 1.rb 931ms 3.2ms 19.5MB 910ms 7ms ruby 3.4.3

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 1.1ms 0.1ms 1.6MB 0ms 0ms odin 2024
ruby 1.rb 34ms 0.6ms 140.7MB 12ms 24ms truffleruby 24.2.1
ruby 1.rb 50ms 0.5ms 13.0MB 36ms 4ms ruby/yjit 3.4.3
ruby 1.rb 52ms 1.7ms 12.8MB 38ms 0ms ruby 3.4.3

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 156ms 3.3ms 1.6MB 150ms 0ms odin 2024
ruby 1.rb 336ms 3.0ms 13.5MB 320ms 7ms ruby/yjit 3.4.3
ruby 1.rb 528ms 0.6ms 12.9MB 510ms 0ms ruby 3.4.3
ruby 1-m.rb 649ms 12ms 361.2MB 1150ms 143ms truffleruby 24.2.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 458ms 2.9ms 1.6MB 450ms 0ms odin 2024
ruby 1.rb 891ms 5.7ms 13.5MB 873ms 3ms ruby/yjit 3.4.3
ruby 1-m.rb 1218ms 28ms 399.4MB 1703ms 157ms truffleruby 24.2.1
ruby 1.rb 1472ms 6.0ms 12.9MB 1453ms 3ms ruby 3.4.3

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 71ms 1.8ms 1.6MB 63ms 0ms odin 2024
ruby 1.rb 194ms 4.2ms 13.4MB 177ms 7ms ruby/yjit 3.4.3
ruby 1.rb 288ms 3.8ms 12.8MB 270ms 3ms ruby 3.4.3
ruby 1-m.rb 516ms 39ms 354.9MB 993ms 137ms 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.5ms 4.6MB 277ms 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 355ms 2.4ms 1.5MB 347ms 0ms odin 2024
odin 1-i.odin 358ms 2.1ms 1.5MB 350ms 0ms odin 2024
ruby 2.rb 820ms 8.8ms 310.7MB 1043ms 117ms truffleruby 24.2.1
ruby 2.rb timeout 0.0ms 12.8MB 4987ms 3ms ruby 3.4.3
ruby 2.rb timeout 0.0ms 13.5MB 4983ms 0ms ruby/yjit 3.4.3

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 38ms 0.9ms 1.5MB 30ms 0ms odin 2024
odin 1-i.odin 38ms 1.6ms 1.5MB 30ms 0ms odin 2024
ruby 2-m.rb 312ms 9.0ms 309.6MB 540ms 117ms truffleruby 24.2.1
ruby 2.rb 1025ms 2.6ms 13.5MB 1010ms 0ms ruby/yjit 3.4.3
ruby 2.rb 2856ms 28ms 12.8MB 2840ms 0ms ruby 3.4.3

nsieve

Input: 12

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 286ms 4.5ms 40.6MB 273ms 3ms odin 2024
odin 2.odin 695ms 43ms 6.5MB 683ms 0ms odin 2024
ruby 1.rb timeout 0.0ms 325.3MB 4853ms 133ms ruby 3.4.3
ruby 1.rb timeout 0.0ms 327.0MB 4860ms 130ms ruby/yjit 3.4.3
ruby 1.rb timeout 0.0ms 731.8MB 5057ms 157ms truffleruby 24.2.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 55ms 5.9ms 11.4MB 43ms 0ms odin 2024
odin 2.odin 183ms 3.1ms 2.8MB 173ms 0ms odin 2024
ruby 1-m.rb 1692ms 8.3ms 475.4MB 2483ms 163ms truffleruby 24.2.1
ruby 1.rb 3437ms 77ms 131.8MB 3337ms 83ms ruby/yjit 3.4.3
ruby 1.rb 4403ms 32ms 131.0MB 4307ms 80ms ruby 3.4.3

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 3599ms 3.9ms 2.9MB 3590ms 0ms odin 2024
ruby 4.rb timeout 0.0ms 12.9MB 4980ms 3ms ruby 3.4.3
ruby 4.rb timeout 0.0ms 13.5MB 4983ms 3ms ruby/yjit 3.4.3
ruby 4.rb timeout 0.0ms 412.4MB 5180ms 223ms truffleruby 24.2.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 903ms 2.9ms 2.3MB 893ms 0ms odin 2024
ruby 4.rb 4838ms 9.1ms 424.1MB 5130ms 203ms truffleruby 24.2.1
ruby 4.rb timeout 0.0ms 12.9MB 4980ms 7ms ruby 3.4.3
ruby 4.rb timeout 0.0ms 13.5MB 4983ms 3ms ruby/yjit 3.4.3

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 228ms 0.8ms 1.9MB 220ms 0ms odin 2024
ruby 4.rb 1417ms 19ms 373.9MB 1763ms 130ms truffleruby 24.2.1
ruby 4.rb timeout 0.0ms 12.9MB 4980ms 7ms ruby 3.4.3
ruby 4.rb timeout 0.0ms 13.8MB 4980ms 3ms ruby/yjit 3.4.3