Php VS Ruby benchmarks

Current benchmark data was generated on Mon Oct 03 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
php 1.php timeout 0.0ms 0.0MB 0ms 0ms php 8.1.10
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
ruby 1-m.rb 895ms 44ms 398.0MB 1443ms 123ms truffleruby 22.2.0
ruby 1.rb 905ms 6.4ms 292.0MB 750ms 140ms ruby/yjit 3.1.2
ruby 1.rb 973ms 7.5ms 35.5MB 940ms 13ms ruby 3.1.2
php 1.php timeout 0.0ms 0.0MB 0ms 0ms php 8.1.10

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 41ms 2.4ms 48.1MB 16ms 8ms php 8.1.10
ruby 1.rb 42ms 2.5ms 148.7MB 18ms 22ms truffleruby 22.2.0
ruby 1.rb 70ms 0.2ms 30.0MB 48ms 6ms ruby 3.1.2
ruby 1.rb 238ms 0.3ms 286.6MB 94ms 134ms ruby/yjit 3.1.2

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php timeout 0.0ms 0.0MB 0ms 0ms php 8.1.10
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
ruby 1-m.rb 3172ms 18ms 560.6MB 5827ms 207ms truffleruby 22.2.0
ruby 1.rb 3949ms 15ms 300.8MB 3790ms 140ms ruby/yjit 3.1.2
ruby 1.rb 4772ms 16ms 44.3MB 4743ms 13ms ruby 3.1.2
php 1.php timeout 0.0ms 0.0MB 0ms 0ms php 8.1.10