Perl VS Ruby benchmarks

Current benchmark data was generated on Wed Feb 08 2023, full log can be found HERE

CONTRIBUTIONS are WELCOME!

[x86_64][2 cores] Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz (Model 85)

* -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
perl 1.pl timeout 0.0ms 77.7MB 4957ms 27ms perl 5.36.0
ruby 1.rb timeout 0.0ms 72.6MB 4940ms 40ms ruby 3.2.0
ruby 1.rb timeout 0.0ms 82.1MB 4923ms 57ms ruby/yjit 3.2.0
ruby 1.rb timeout 0.0ms 471.3MB 8477ms 293ms truffleruby 22.3.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 718ms 9.3ms 40.7MB 673ms 30ms ruby/yjit 3.2.0
ruby 1.rb 1269ms 18ms 40.3MB 1233ms 20ms ruby 3.2.0
ruby 1-m.rb 1341ms 27ms 400.1MB 2230ms 170ms truffleruby 22.3.1
perl 1.pl 2570ms 26ms 14.3MB 2550ms 3ms perl 5.36.0

fasta

Input: 2500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 6.rb 2828ms 11ms 43.6MB 2787ms 27ms ruby/yjit 3.2.0
ruby 6-m.rb 3219ms 20ms 392.0MB 5753ms 340ms truffleruby 22.3.1
perl 1.pl timeout 0.0ms 11.1MB 4970ms 3ms perl 5.36.0
ruby 6.rb timeout 0.0ms 42.9MB 4957ms 23ms ruby 3.2.0

Input: 250000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 6.rb 368ms 4.1ms 35.0MB 337ms 17ms ruby/yjit 3.2.0
perl 1.pl 536ms 6.3ms 6.8MB 523ms 0ms perl 5.36.0
ruby 6.rb 594ms 3.7ms 34.4MB 557ms 17ms ruby 3.2.0
ruby 6-m.rb 1035ms 11ms 324.2MB 1757ms 143ms truffleruby 22.3.1

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 1.pl 3.8ms 0.6ms 5.1MB 0ms 0ms perl 5.36.0
ruby 1.rb 54ms 1.8ms 153.4MB 30ms 28ms truffleruby 22.3.1
ruby 1.rb 87ms 1.1ms 32.1MB 52ms 18ms ruby 3.2.0
ruby 1.rb 91ms 4.1ms 32.3MB 64ms 14ms ruby/yjit 3.2.0

nbody

Input: 5000000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 2.rb 1435ms 12ms 298.5MB 1713ms 100ms truffleruby 22.3.1
perl 2.pl timeout 0.0ms 6.4MB 4987ms 3ms perl 5.36.0
ruby 2.rb timeout 0.0ms 32.2MB 4970ms 13ms ruby 3.2.0
ruby 2.rb timeout 0.0ms 33.0MB 4963ms 13ms ruby/yjit 3.2.0

Input: 500000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 2-m.rb 513ms 25ms 309.9MB 770ms 127ms truffleruby 22.3.1
ruby 2.rb 2528ms 32ms 33.1MB 2487ms 23ms ruby/yjit 3.2.0
perl 2.pl 3680ms 19ms 6.3MB 3667ms 0ms perl 5.36.0
ruby 2.rb 4072ms 73ms 32.2MB 4043ms 13ms ruby 3.2.0

spectral-norm

Input: 8000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 4.pl timeout 0.0ms 8.2MB 9847ms 3ms perl 5.36.0
ruby 4.rb timeout 0.0ms 32.2MB 4967ms 10ms ruby 3.2.0
ruby 4.rb timeout 0.0ms 32.9MB 4973ms 13ms ruby/yjit 3.2.0
ruby 4.rb timeout 0.0ms 404.5MB 5227ms 213ms truffleruby 22.3.1

Input: 4000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
perl 4.pl timeout 0.0ms 9.6MB 9703ms 3ms perl 5.36.0
ruby 4.rb timeout 0.0ms 32.2MB 4970ms 17ms ruby 3.2.0
ruby 4.rb timeout 0.0ms 32.8MB 4957ms 20ms ruby/yjit 3.2.0
ruby 4.rb timeout 0.0ms 460.5MB 5583ms 183ms truffleruby 22.3.1

Input: 2000

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 4.rb 3275ms 18ms 360.5MB 3963ms 167ms truffleruby 22.3.1
perl 4.pl timeout 0.0ms 8.3MB 9687ms 10ms perl 5.36.0
ruby 4.rb timeout 0.0ms 32.0MB 4960ms 23ms ruby 3.2.0
ruby 4.rb timeout 0.0ms 32.9MB 4967ms 10ms ruby/yjit 3.2.0