Dart VS Ruby benchmarks

Current benchmark data was generated on Thu Dec 26 2024, 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
dart 1.dart 729ms 7.9ms 80.7MB 700ms 37ms dart/exe 3.6.0
ruby 1-m.rb 4491ms 255ms 828.5MB 6487ms 460ms truffleruby 24.1.1
ruby 1.rb 4740ms 6.4ms 109.5MB 4613ms 103ms ruby/yjit 3.4.1
ruby 1.rb timeout 0.0ms 70.0MB 4947ms 37ms ruby 3.4.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 78ms 0.8ms 42.9MB 50ms 13ms dart/exe 3.6.0
ruby 1.rb 480ms 0.6ms 20.4MB 440ms 20ms ruby/yjit 3.4.1
ruby 1-m.rb 594ms 76ms 440.6MB 1170ms 157ms truffleruby 24.1.1
ruby 1.rb 951ms 5.6ms 19.6MB 927ms 10ms ruby 3.4.1

coro-prime-sieve

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 1425ms 14ms 63.8MB 1353ms 53ms ruby/yjit 3.4.1
dart 1-m.dart 1652ms 2861ms 19.1MB 5583ms 77ms dart/exe 3.6.0
ruby 1.rb 1859ms 25ms 63.1MB 1777ms 67ms ruby 3.4.1
ruby 1.rb timeout 0.0ms 737.4MB 4497ms 1597ms truffleruby 24.1.1

Input: 1000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 159ms 6.0ms 25.8MB 127ms 20ms ruby/yjit 3.4.1
ruby 1.rb 182ms 4.0ms 25.1MB 147ms 23ms ruby 3.4.1
dart 1.dart 343ms 1.4ms 10.3MB 343ms 20ms dart/exe 3.6.0
ruby 1.rb timeout 0.0ms 665.2MB 4673ms 1447ms truffleruby 24.1.1

edigits

Input: 250001

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 3563ms 22ms 18.0MB 3533ms 27ms dart/exe 3.6.0

Input: 100000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 585ms 1.6ms 10.1MB 563ms 13ms dart/exe 3.6.0

fannkuch-redux

Input: 11

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 2748ms 14ms 6.1MB 2737ms 0ms dart/exe 3.6.0

Input: 10

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 227ms 3.7ms 6.1MB 217ms 0ms dart/exe 3.6.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 362ms 4.0ms 8.9MB 350ms 0ms dart/exe 3.6.0
ruby 6.rb 2040ms 7.9ms 23.1MB 2017ms 7ms ruby/yjit 3.4.1
ruby 6-m.rb 2364ms 323ms 408.9MB 6043ms 397ms truffleruby 24.1.1
ruby 6.rb 3668ms 23ms 22.5MB 3640ms 13ms ruby 3.4.1

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 42ms 0.5ms 8.8MB 33ms 0ms dart/exe 3.6.0
ruby 6.rb 261ms 2.4ms 15.3MB 243ms 0ms ruby/yjit 3.4.1
ruby 6.rb 421ms 3.2ms 14.5MB 400ms 7ms ruby 3.4.1
ruby 6-m.rb 822ms 12ms 399.7MB 1987ms 200ms truffleruby 24.1.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 4.1ms 0.2ms 6.3MB 0ms 0ms dart/exe 3.6.0
ruby 1.rb 41ms 0.3ms 159.6MB 18ms 30ms truffleruby 24.1.1
ruby 1.rb 53ms 0.7ms 13.1MB 36ms 6ms ruby/yjit 3.4.1
ruby 1.rb 54ms 1.1ms 13.0MB 38ms 4ms ruby 3.4.1

http-server

Input: 3000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2-m.dart 1493ms 15ms 115.8MB 1150ms 1607ms dart/exe 3.6.0
dart 1.dart 4313ms 195ms 118.9MB 1230ms 1553ms dart/exe 3.6.0

Input: 500

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2-m.dart 309ms 8.5ms 50.0MB 203ms 293ms dart/exe 3.6.0
dart 1.dart 1340ms 116ms 49.9MB 153ms 253ms dart/exe 3.6.0

json-serde

Input: sample 5000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 168ms 2.3ms 54.2MB 150ms 10ms dart/exe 3.6.0
ruby 1.rb 255ms 4.6ms 28.1MB 220ms 20ms ruby/yjit 3.4.1
ruby 1.rb 257ms 6.3ms 29.4MB 223ms 20ms ruby 3.4.1
ruby 1-m.rb 1433ms 2482ms 486.4MB 12433ms 350ms truffleruby 24.1.1

Input: canada 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 1476ms 12ms 299.3MB 1540ms 117ms dart/exe 3.6.0
ruby 1.rb 2081ms 2.9ms 134.6MB 2003ms 63ms ruby 3.4.1
ruby 1.rb 2081ms 5.2ms 163.0MB 1967ms 100ms ruby/yjit 3.4.1
ruby 1.rb timeout 0.0ms 504.2MB 13053ms 390ms truffleruby 24.1.1

knucleotide

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3-m.dart 1139ms 62ms 279.7MB 3300ms 113ms dart/exe 3.6.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3-m.dart 224ms 8.3ms 197.1MB 503ms 67ms dart/exe 3.6.0

lru

Input: 1000 1000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 163ms 2.7ms 9.3MB 150ms 0ms dart/exe 3.6.0
ruby 1.rb 335ms 0.7ms 13.6MB 323ms 3ms ruby/yjit 3.4.1
dart 1.dart 511ms 5.2ms 9.1MB 493ms 0ms dart/exe 3.6.0
ruby 1.rb 531ms 2.7ms 13.0MB 513ms 3ms ruby 3.4.1
ruby 1-m.rb 675ms 17ms 385.2MB 1167ms 147ms truffleruby 24.1.1

Input: 1000 3000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 473ms 6.0ms 9.1MB 463ms 0ms dart/exe 3.6.0
ruby 1.rb 878ms 2.2ms 13.6MB 853ms 10ms ruby/yjit 3.4.1
ruby 1-m.rb 1245ms 27ms 413.3MB 1740ms 157ms truffleruby 24.1.1
ruby 1.rb 1488ms 15ms 13.0MB 1467ms 7ms ruby 3.4.1
dart 1.dart 1527ms 12ms 9.1MB 1503ms 10ms dart/exe 3.6.0

Input: 100 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 75ms 0.3ms 9.4MB 67ms 0ms dart/exe 3.6.0
dart 1.dart 121ms 9.8ms 9.0MB 110ms 0ms dart/exe 3.6.0
ruby 1.rb 194ms 1.4ms 13.5MB 177ms 7ms ruby/yjit 3.4.1
ruby 1.rb 293ms 7.6ms 12.9MB 277ms 3ms ruby 3.4.1
ruby 1-m.rb 525ms 16ms 372.7MB 1020ms 140ms truffleruby 24.1.1

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 335ms 2.0ms 63.6MB 303ms 33ms dart/exe 3.6.0
ruby 1-m.rb 4732ms 282ms 602.2MB 12110ms 367ms truffleruby 24.1.1
ruby 1.rb timeout 0.0ms 93.6MB 4923ms 60ms ruby 3.4.1
ruby 1.rb timeout 0.0ms 97.4MB 4930ms 53ms ruby/yjit 3.4.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 88ms 1.8ms 43.6MB 57ms 20ms dart/exe 3.6.0
ruby 1-m.rb 2353ms 97ms 519.1MB 6020ms 270ms truffleruby 24.1.1
ruby 1.rb 3305ms 32ms 38.3MB 3273ms 13ms ruby/yjit 3.4.1
ruby 1.rb 4367ms 19ms 37.8MB 4327ms 23ms ruby 3.4.1

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3.dart 408ms 3.0ms 6.1MB 397ms 0ms dart/exe 3.6.0
ruby 2.rb 845ms 8.3ms 326.9MB 1093ms 103ms truffleruby 24.1.1
ruby 2.rb timeout 0.0ms 12.9MB 4980ms 7ms ruby 3.4.1
ruby 2.rb timeout 0.0ms 13.6MB 4973ms 10ms ruby/yjit 3.4.1

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 3.dart 46ms 0.1ms 6.3MB 33ms 0ms dart/exe 3.6.0
ruby 2-m.rb 326ms 4.0ms 327.1MB 557ms 123ms truffleruby 24.1.1
ruby 2.rb 1060ms 3.3ms 13.6MB 1040ms 10ms ruby/yjit 3.4.1
ruby 2.rb 2825ms 48ms 12.9MB 2810ms 0ms ruby 3.4.1

pidigits

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 1252ms 6.2ms 14.6MB 1213ms 37ms dart/exe 3.6.0
ruby 1.rb timeout 0.0ms 46.4MB 4930ms 60ms ruby 3.4.1
ruby 1.rb timeout 0.0ms 127.6MB 4860ms 127ms ruby/yjit 3.4.1
ruby 1.rb timeout 0.0ms 470.6MB 12967ms 403ms truffleruby 24.1.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 2.dart 311ms 4.2ms 14.8MB 290ms 17ms dart/exe 3.6.0
ruby 1.rb 1657ms 12ms 46.1MB 1610ms 33ms ruby 3.4.1
ruby 1.rb 1709ms 74ms 127.8MB 1613ms 80ms ruby/yjit 3.4.1
ruby 1-m.rb 1735ms 88ms 434.9MB 4533ms 207ms truffleruby 24.1.1

regex-redux

Input: 2500000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart timeout 0.0ms 204.3MB 4940ms 63ms dart/exe 3.6.0

Input: 250000_in

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 559ms 5.1ms 48.0MB 537ms 13ms dart/exe 3.6.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 3742ms 9.1ms 6.4MB 3730ms 0ms dart/exe 3.6.0
dart 2.dart 4346ms 17ms 6.3MB 4333ms 0ms dart/exe 3.6.0
ruby 4.rb timeout 0.0ms 12.9MB 4983ms 3ms ruby 3.4.1
ruby 4.rb timeout 0.0ms 13.6MB 4977ms 7ms ruby/yjit 3.4.1
ruby 4.rb timeout 0.0ms 454.0MB 5130ms 247ms truffleruby 24.1.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 939ms 2.8ms 6.3MB 927ms 0ms dart/exe 3.6.0
dart 2.dart 1097ms 4.9ms 6.3MB 1087ms 0ms dart/exe 3.6.0
ruby 4.rb 4489ms 16ms 449.9MB 4777ms 200ms truffleruby 24.1.1
ruby 4.rb timeout 0.0ms 13.0MB 4980ms 3ms ruby 3.4.1
ruby 4.rb timeout 0.0ms 13.8MB 4977ms 10ms ruby/yjit 3.4.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
dart 1.dart 242ms 2.8ms 6.3MB 233ms 0ms dart/exe 3.6.0
dart 2.dart 280ms 1.9ms 6.1MB 267ms 0ms dart/exe 3.6.0
ruby 4.rb 1274ms 61ms 395.5MB 1590ms 140ms truffleruby 24.1.1
ruby 4.rb timeout 0.0ms 13.0MB 4980ms 3ms ruby 3.4.1
ruby 4.rb timeout 0.0ms 13.8MB 4980ms 7ms ruby/yjit 3.4.1