Php VS Ruby benchmarks

Current benchmark data was generated on Mon Jun 23 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.rb 4905ms 47ms 110.1MB 4803ms 87ms ruby/yjit 3.4.4
php 1.php timeout 0.0ms 141.9MB 4963ms 27ms php 8.2.28
ruby 1.rb timeout 0.0ms 70.5MB 4950ms 37ms ruby 3.4.4
ruby 1.rb timeout 0.0ms 757.2MB 6760ms 690ms truffleruby 24.2.1

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 500ms 4.2ms 20.3MB 477ms 10ms ruby/yjit 3.4.4
ruby 1-m.rb 571ms 43ms 418.8MB 1113ms 167ms truffleruby 24.2.1
php 1.php 621ms 4.0ms 62.7MB 587ms 20ms php 8.2.28
ruby 1.rb 948ms 9.8ms 19.5MB 927ms 10ms ruby 3.4.4

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 36ms 0.9ms 141.8MB 12ms 30ms truffleruby 24.2.1
php 1.php 47ms 0.9ms 52.3MB 16ms 20ms php 8.2.28
ruby 1.rb 51ms 1.3ms 12.8MB 40ms 0ms ruby 3.4.4
ruby 1.rb 54ms 1.3ms 12.9MB 40ms 4ms ruby/yjit 3.4.4

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 3756ms 39ms 113.6MB 3717ms 23ms php 8.2.28
ruby 1-m.rb 3904ms 35ms 557.5MB 9970ms 347ms truffleruby 24.2.1
ruby 1.rb timeout 0.0ms 93.5MB 4940ms 47ms ruby 3.4.4
ruby 1.rb timeout 0.0ms 97.2MB 4940ms 47ms ruby/yjit 3.4.4

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 823ms 5.4ms 66.8MB 787ms 20ms php 8.2.28
ruby 1-m.rb 2022ms 35ms 597.2MB 5207ms 257ms truffleruby 24.2.1
ruby 1.rb 3278ms 18ms 38.4MB 3243ms 20ms ruby/yjit 3.4.4
ruby 1.rb 4357ms 20ms 37.6MB 4323ms 20ms ruby 3.4.4