Php VS Ruby benchmarks

Current benchmark data was generated on Mon Apr 14 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 4815ms 21ms 109.4MB 4710ms 90ms ruby/yjit 3.4.2
php 1.php timeout 0.0ms 141.9MB 4957ms 27ms php 8.2.28
ruby 1.rb timeout 0.0ms 70.5MB 4953ms 37ms ruby 3.4.2
ruby 1.rb timeout 0.0ms 758.8MB 6567ms 693ms truffleruby 24.2.0

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 492ms 5.0ms 20.4MB 467ms 10ms ruby/yjit 3.4.2
ruby 1-m.rb 537ms 66ms 418.7MB 1060ms 157ms truffleruby 24.2.0
php 1.php 625ms 5.0ms 63.0MB 593ms 17ms php 8.2.28
ruby 1.rb 937ms 8.8ms 19.6MB 910ms 13ms 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.5ms 141.8MB 14ms 24ms truffleruby 24.2.0
php 1.php 50ms 1.2ms 52.5MB 18ms 22ms php 8.2.28
ruby 1.rb 51ms 1.1ms 12.9MB 38ms 0ms ruby 3.4.2
ruby 1.rb 53ms 1.6ms 13.1MB 38ms 2ms ruby/yjit 3.4.2

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 4002ms 68ms 114.0MB 3960ms 27ms php 8.2.28
ruby 1-m.rb 4155ms 538ms 542.6MB 10537ms 360ms 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.1MB 4943ms 40ms ruby/yjit 3.4.2

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 851ms 7.8ms 67.1MB 820ms 20ms php 8.2.28
ruby 1-m.rb 2026ms 131ms 594.1MB 5157ms 270ms truffleruby 24.2.0
ruby 1.rb 3422ms 26ms 38.3MB 3383ms 23ms ruby/yjit 3.4.2
ruby 1.rb 4463ms 59ms 37.8MB 4427ms 27ms ruby 3.4.2