Php VS Ruby benchmarks

Current benchmark data was generated on Tue Apr 01 2025, 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
ruby 1-m.rb 4767ms 126ms 811.9MB 6707ms 477ms truffleruby 24.2.0
ruby 1.rb 4863ms 1.8ms 109.4MB 4763ms 83ms ruby/yjit 3.4.2
php 1.php timeout 0.0ms 141.8MB 4963ms 23ms php 8.2.28
ruby 1.rb timeout 0.0ms 70.1MB 4940ms 43ms ruby 3.4.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 508ms 33ms 20.3MB 483ms 10ms ruby/yjit 3.4.2
ruby 1-m.rb 555ms 69ms 418.8MB 1097ms 167ms truffleruby 24.2.0
php 1.php 623ms 2.8ms 63.1MB 587ms 23ms php 8.2.28
ruby 1.rb 928ms 2.7ms 19.6MB 903ms 10ms ruby 3.4.2

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 35ms 0.3ms 139.0MB 12ms 24ms truffleruby 24.2.0
php 1.php 52ms 1.0ms 52.8MB 20ms 20ms php 8.2.28
ruby 1.rb 53ms 1.0ms 13.1MB 40ms 2ms ruby/yjit 3.4.2
ruby 1.rb 54ms 1.4ms 12.9MB 40ms 2ms ruby 3.4.2

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 4055ms 54ms 114.0MB 4010ms 30ms php 8.2.28
ruby 1-m.rb 4430ms 469ms 527.4MB 11217ms 380ms truffleruby 24.2.0
ruby 1.rb timeout 0.0ms 93.6MB 4933ms 50ms ruby 3.4.2
ruby 1.rb timeout 0.0ms 94.8MB 4940ms 50ms ruby/yjit 3.4.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 842ms 8.7ms 67.2MB 803ms 20ms php 8.2.28
ruby 1-m.rb 1938ms 44ms 591.3MB 5030ms 250ms truffleruby 24.2.0
ruby 1.rb 3421ms 15ms 38.3MB 3377ms 30ms ruby/yjit 3.4.2
ruby 1.rb 4437ms 12ms 37.8MB 4397ms 27ms ruby 3.4.2