Odin VS Ruby benchmarks

Current benchmark data was generated on Sun Jun 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 2307ms 6.3ms 49.5MB 2280ms 13ms odin 2024
ruby 1-m.rb 4549ms 73ms 838.0MB 6403ms 490ms truffleruby 24.2.1
ruby 1.rb 4697ms 113ms 110.0MB 4607ms 77ms ruby/yjit 3.4.4
ruby 1.rb timeout 0.0ms 70.4MB 4953ms 37ms ruby 3.4.4

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 221ms 4.9ms 7.5MB 207ms 0ms odin 2024
ruby 1.rb 489ms 7.3ms 20.3MB 463ms 10ms ruby/yjit 3.4.4
ruby 1-m.rb 502ms 12ms 405.6MB 983ms 153ms truffleruby 24.2.1
ruby 1.rb 948ms 7.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 34ms 0.5ms 141.5MB 10ms 26ms truffleruby 24.2.1
ruby 1.rb 50ms 1.4ms 12.9MB 38ms 2ms ruby/yjit 3.4.4
ruby 1.rb 51ms 1.7ms 12.8MB 36ms 2ms ruby 3.4.4

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 157ms 1.1ms 1.6MB 150ms 0ms odin 2024
ruby 1.rb 345ms 2.2ms 13.5MB 327ms 10ms ruby/yjit 3.4.4
ruby 1.rb 531ms 3.8ms 12.9MB 507ms 10ms ruby 3.4.4
ruby 1-m.rb 681ms 22ms 372.4MB 1237ms 140ms 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 3.6ms 1.6MB 447ms 0ms odin 2024
ruby 1.rb 906ms 5.6ms 13.5MB 890ms 3ms ruby/yjit 3.4.4
ruby 1-m.rb 1181ms 17ms 400.4MB 1707ms 157ms truffleruby 24.2.1
ruby 1.rb 1478ms 4.7ms 12.8MB 1460ms 3ms ruby 3.4.4

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 70ms 0.2ms 1.6MB 60ms 0ms odin 2024
ruby 1.rb 194ms 1.0ms 13.5MB 177ms 7ms ruby/yjit 3.4.4
ruby 1.rb 292ms 3.6ms 12.8MB 280ms 7ms ruby 3.4.4
ruby 1-m.rb 532ms 4.1ms 356.3MB 1023ms 140ms truffleruby 24.2.1

mandelbrot

Input: 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 286ms 0.5ms 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 354ms 2.5ms 1.5MB 343ms 0ms odin 2024
odin 1-i.odin 356ms 1.4ms 1.5MB 350ms 0ms odin 2024
ruby 2.rb 823ms 8.8ms 310.2MB 1070ms 110ms truffleruby 24.2.1
ruby 2.rb timeout 0.0ms 12.8MB 4983ms 3ms ruby 3.4.4
ruby 2.rb timeout 0.0ms 13.5MB 4983ms 3ms 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.3ms 1.5MB 30ms 0ms odin 2024
odin 1.odin 39ms 0.5ms 1.5MB 30ms 0ms odin 2024
ruby 2-m.rb 323ms 5.2ms 325.5MB 593ms 110ms truffleruby 24.2.1
ruby 2.rb 1025ms 6.4ms 13.5MB 1010ms 3ms ruby/yjit 3.4.4
ruby 2.rb 2919ms 94ms 12.8MB 2903ms 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 267ms 7.1ms 40.5MB 253ms 7ms odin 2024
odin 2.odin 722ms 37ms 6.5MB 713ms 0ms odin 2024
ruby 1.rb timeout 0.0ms 325.3MB 4850ms 133ms ruby 3.4.4
ruby 1.rb timeout 0.0ms 327.0MB 4847ms 140ms ruby/yjit 3.4.4
ruby 1.rb timeout 0.0ms 731.9MB 5060ms 163ms truffleruby 24.2.1

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 56ms 4.6ms 11.3MB 47ms 0ms odin 2024
odin 2.odin 179ms 8.0ms 2.8MB 170ms 0ms odin 2024
ruby 1-m.rb 1696ms 5.1ms 473.6MB 2500ms 160ms truffleruby 24.2.1
ruby 1.rb 3471ms 137ms 131.8MB 3380ms 80ms ruby/yjit 3.4.4
ruby 1.rb 4452ms 24ms 131.1MB 4367ms 70ms 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 3598ms 2.4ms 2.9MB 3590ms 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 4980ms 3ms ruby/yjit 3.4.4
ruby 4.rb timeout 0.0ms 436.2MB 5167ms 233ms truffleruby 24.2.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
odin 1.odin 902ms 1.5ms 2.3MB 890ms 0ms odin 2024
ruby 4.rb 4820ms 15ms 423.5MB 5103ms 203ms truffleruby 24.2.1
ruby 4.rb timeout 0.0ms 12.9MB 4987ms 3ms ruby 3.4.4
ruby 4.rb timeout 0.0ms 13.5MB 4980ms 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 227ms 0.9ms 1.9MB 220ms 0ms odin 2024
ruby 4.rb 1453ms 19ms 405.2MB 1797ms 150ms truffleruby 24.2.1
ruby 4.rb timeout 0.0ms 12.9MB 4983ms 7ms ruby 3.4.4
ruby 4.rb timeout 0.0ms 13.6MB 4980ms 7ms ruby/yjit 3.4.4