Ruby VS Dart benchmarks

Current benchmark data was generated on Thu Sep 22 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 1022ms 3.0ms 87.4MB 997ms 30ms dart/exe 2.18.1
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.2.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 101ms 0.1ms 48.2MB 77ms 17ms dart/exe 2.18.1
ruby 1-m.rb 893ms 4.8ms 400.8MB 1437ms 140ms truffleruby 22.2.0
ruby 1.rb 909ms 3.9ms 292.0MB 757ms 133ms ruby/yjit 3.1.2
ruby 1.rb 973ms 6.2ms 35.5MB 940ms 17ms 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 3096ms 14ms 336.6MB 2900ms 177ms ruby/yjit 3.1.2
ruby 1.rb 3554ms 6.1ms 80.2MB 3490ms 50ms ruby 3.1.2
dart 1.dart timeout 0.0ms 0.0MB 0ms 0ms dart/exe 2.18.1
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.2.0

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 240ms 4.4ms 42.2MB 200ms 20ms ruby 3.1.2
ruby 1.rb 382ms 1.7ms 298.8MB 227ms 143ms ruby/yjit 3.1.2
dart 1.dart 572ms 5.1ms 14.8MB 557ms 13ms dart/exe 2.18.1
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.2.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 545ms 1.8ms 17.0MB 530ms 0ms dart/exe 2.18.1
ruby 6.rb 2845ms 14ms 296.0MB 2673ms 153ms ruby/yjit 3.1.2
ruby 6.rb 4360ms 38ms 39.4MB 4327ms 20ms ruby 3.1.2
ruby 6.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.2.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 64ms 0.5ms 14.4MB 50ms 0ms dart/exe 2.18.1
ruby 6.rb 504ms 2.6ms 287.6MB 353ms 137ms ruby/yjit 3.1.2
ruby 6.rb 505ms 3.9ms 31.1MB 477ms 13ms ruby 3.1.2
ruby 6-m.rb 1331ms 21ms 387.2MB 2350ms 107ms truffleruby 22.2.0

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 41ms 1.1ms 145.7MB 22ms 16ms truffleruby 22.2.0
ruby 1.rb 70ms 0.9ms 29.9MB 48ms 10ms ruby 3.1.2
ruby 1.rb 240ms 1.6ms 286.6MB 100ms 124ms ruby/yjit 3.1.2
dart 1.dart 807ms 448ms 11.6MB 0ms 0ms dart/exe 2.18.1

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 259ms 1.0ms 57.7MB 240ms 13ms dart/exe 2.18.1
ruby 1.rb 430ms 1.4ms 49.3MB 397ms 23ms ruby 3.1.2
ruby 1.rb 600ms 1.7ms 305.1MB 437ms 143ms ruby/yjit 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.2.0

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 2170ms 29ms 298.7MB 2220ms 127ms dart/exe 2.18.1
ruby 1.rb 3872ms 2.8ms 160.1MB 3780ms 73ms ruby 3.1.2
ruby 1.rb 4140ms 173ms 418.9MB 3917ms 207ms ruby/yjit 3.1.2
ruby 1.rb timeout 0.0ms 0.0MB 0ms 0ms truffleruby 22.2.0

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 238ms 2.0ms 15.0MB 223ms 3ms dart/exe 2.18.1
ruby 1.rb 609ms 6.2ms 30.2MB 580ms 10ms ruby 3.1.2
ruby 1.rb 627ms 4.1ms 286.6MB 487ms 127ms ruby/yjit 3.1.2
ruby 1-m.rb 746ms 6.4ms 314.0MB 1080ms 93ms truffleruby 22.2.0
dart 1.dart 1416ms 2.3ms 14.7MB 1407ms 0ms dart/exe 2.18.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 694ms 9.5ms 16.9MB 683ms 0ms dart/exe 2.18.1
ruby 1.rb 1388ms 18ms 286.8MB 1247ms 127ms ruby/yjit 3.1.2
ruby 1.rb 1391ms 3.8ms 339.8MB 1920ms 120ms truffleruby 22.2.0
ruby 1.rb 1675ms 30ms 30.2MB 1650ms 13ms ruby 3.1.2
dart 1.dart 4250ms 6.9ms 15.1MB 4233ms 10ms dart/exe 2.18.1

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 113ms 1.6ms 16.7MB 97ms 3ms dart/exe 2.18.1
dart 1.dart 208ms 3.9ms 14.0MB 190ms 0ms dart/exe 2.18.1
ruby 1.rb 347ms 5.8ms 29.9MB 327ms 7ms ruby 3.1.2
ruby 1.rb 433ms 1.2ms 286.7MB 290ms 127ms ruby/yjit 3.1.2
ruby 1-m.rb 538ms 7.6ms 297.4MB 823ms 73ms truffleruby 22.2.0

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 507ms 3.7ms 70.7MB 477ms 33ms dart/exe 2.18.1
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.2.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 126ms 0.9ms 51.1MB 100ms 17ms dart/exe 2.18.1
ruby 1-m.rb 3161ms 37ms 580.5MB 5767ms 237ms truffleruby 22.2.0
ruby 1.rb 3960ms 18ms 300.9MB 3797ms 143ms ruby/yjit 3.1.2
ruby 1.rb 4792ms 15ms 44.4MB 4750ms 30ms ruby 3.1.2

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3.dart 520ms 1.7ms 13.8MB 503ms 0ms dart/exe 2.18.1
ruby 2.rb 1108ms 5.4ms 317.8MB 1390ms 100ms truffleruby 22.2.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 1.1ms 14.0MB 50ms 0ms dart/exe 2.18.1
ruby 2-m.rb 421ms 1.4ms 300.5MB 650ms 100ms truffleruby 22.2.0
ruby 2.rb 2353ms 2.0ms 286.7MB 2207ms 123ms ruby/yjit 3.1.2
ruby 2.rb 3241ms 15ms 29.9MB 3217ms 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.2.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 3198ms 35ms 463.2MB 3600ms 157ms truffleruby 22.2.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 1746ms 53ms 22.3MB 1730ms 60ms dart/exe 2.18.1
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.2.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 444ms 13ms 22.3MB 427ms 30ms dart/exe 2.18.1
ruby 1-m.rb 1925ms 1.4ms 383.9MB 3523ms 147ms truffleruby 22.2.0
ruby 1.rb 2499ms 1.8ms 161.8MB 2413ms 67ms ruby 3.1.2
ruby 1.rb 2661ms 4.8ms 420.8MB 2450ms 193ms 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.18.1
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.2.0

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 1297ms 1.1ms 12.1MB 1280ms 0ms dart/exe 2.18.1
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.2.0

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 331ms 0.7ms 13.7MB 317ms 0ms dart/exe 2.18.1
ruby 4.rb 2456ms 33ms 462.5MB 2987ms 150ms truffleruby 22.2.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