Ruby VS Dart 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.)

binarytrees

Input: 18

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 1175ms 1.0ms 86.0MB 1150ms 40ms dart/exe 2.17.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
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 120ms 2.8ms 49.2MB 100ms 13ms dart/exe 2.17.0
ruby 1.rb 897ms 6.4ms 292.1MB 740ms 137ms ruby/yjit 3.1.2
ruby 1-m.rb 951ms 78ms 404.6MB 1523ms 130ms truffleruby 22.1.0
ruby 1.rb 976ms 8.7ms 35.5MB 930ms 23ms ruby 3.1.2

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 3053ms 9.8ms 336.7MB 2847ms 190ms ruby/yjit 3.1.2
ruby 1.rb 3564ms 76ms 80.2MB 3487ms 60ms ruby 3.1.2
dart 1.dart timeout 0.0ms 0.0MB 0ms 0ms dart/exe 2.17.0
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 243ms 3.7ms 42.3MB 203ms 23ms ruby 3.1.2
ruby 1.rb 375ms 3.0ms 298.9MB 220ms 137ms ruby/yjit 3.1.2
dart 1.dart 1215ms 11ms 227.3MB 1130ms 145ms dart/exe 2.17.0
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 560ms 1.4ms 21.9MB 540ms 3ms dart/exe 2.17.0
ruby 6.rb 2839ms 35ms 295.0MB 2677ms 143ms ruby/yjit 3.1.2
ruby 6.rb 4345ms 16ms 39.8MB 4310ms 17ms ruby 3.1.2
ruby 6.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 64ms 1.0ms 16.4MB 50ms 3ms dart/exe 2.17.0
ruby 6.rb 491ms 2.7ms 287.8MB 340ms 133ms ruby/yjit 3.1.2
ruby 6.rb 507ms 8.2ms 31.1MB 483ms 7ms ruby 3.1.2
ruby 6-m.rb 1439ms 22ms 368.9MB 2527ms 140ms truffleruby 22.1.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 6.6ms 0.4ms 11.9MB 0ms 0ms dart/exe 2.17.0
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

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 273ms 0.9ms 58.6MB 257ms 7ms dart/exe 2.17.0
ruby 1.rb 436ms 5.7ms 48.1MB 397ms 20ms ruby 3.1.2
ruby 1.rb 592ms 3.6ms 304.6MB 433ms 140ms ruby/yjit 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 2207ms 5.7ms 278.4MB 2277ms 127ms dart/exe 2.17.0
ruby 1.rb 3896ms 8.6ms 160.2MB 3783ms 97ms ruby 3.1.2
ruby 1.rb 4051ms 2.5ms 417.8MB 3817ms 220ms ruby/yjit 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 246ms 0.1ms 35.6MB 227ms 7ms dart/exe 2.17.0
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
dart 1.dart 1459ms 1.3ms 44.4MB 1437ms 7ms dart/exe 2.17.0

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 705ms 2.3ms 42.9MB 687ms 10ms dart/exe 2.17.0
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
dart 1.dart 4331ms 1.5ms 44.5MB 4307ms 10ms dart/exe 2.17.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 116ms 3.4ms 23.1MB 100ms 0ms dart/exe 2.17.0
dart 1.dart 222ms 0.9ms 44.7MB 200ms 7ms dart/exe 2.17.0
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

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 653ms 6.2ms 71.7MB 630ms 33ms dart/exe 2.17.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
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.1.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 157ms 1.0ms 51.1MB 133ms 17ms dart/exe 2.17.0
ruby 1-m.rb 3310ms 16ms 583.4MB 6047ms 240ms truffleruby 22.1.0
ruby 1.rb 3946ms 4.7ms 300.9MB 3780ms 147ms ruby/yjit 3.1.2
ruby 1.rb 4797ms 7.7ms 44.4MB 4757ms 23ms ruby 3.1.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3.dart 517ms 1.4ms 13.8MB 503ms 0ms dart/exe 2.17.0
ruby 2.rb 1338ms 3.0ms 301.9MB 1703ms 93ms truffleruby 22.1.0
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
dart 3.dart 60ms 0.8ms 11.9MB 43ms 0ms dart/exe 2.17.0
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
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
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

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 1799ms 2.5ms 19.6MB 1773ms 40ms dart/exe 2.17.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
ruby 1.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
dart 2.dart 429ms 1.1ms 20.0MB 410ms 13ms dart/exe 2.17.0
ruby 1-m.rb 2095ms 83ms 383.5MB 3883ms 117ms truffleruby 22.1.0
ruby 1.rb 2507ms 16ms 162.6MB 2430ms 57ms ruby 3.1.2
ruby 1.rb 2676ms 44ms 420.8MB 2477ms 183ms ruby/yjit 3.1.2

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart timeout 0.0ms 0.0MB 0ms 0ms dart/exe 2.17.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
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
dart 1.dart 1296ms 1.1ms 12.0MB 1280ms 0ms dart/exe 2.17.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
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
dart 1.dart 331ms 2.2ms 13.3MB 320ms 0ms dart/exe 2.17.0
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