Php VS Ruby benchmarks

Current benchmark data was generated on Tue Jul 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 4407ms 191ms 804.1MB 6390ms 450ms truffleruby 24.2.1
ruby 1.rb 4955ms 35ms 109.4MB 4853ms 87ms ruby/yjit 3.4.4
php 1.php timeout 0.0ms 141.6MB 4963ms 20ms php 8.2.28
ruby 1.rb timeout 0.0ms 70.5MB 4940ms 40ms ruby 3.4.4

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 505ms 6.5ms 20.3MB 480ms 10ms ruby/yjit 3.4.4
ruby 1-m.rb 570ms 55ms 424.9MB 1133ms 167ms truffleruby 24.2.1
php 1.php 614ms 0.1ms 62.7MB 583ms 17ms php 8.2.28
ruby 1.rb 967ms 21ms 19.5MB 943ms 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 35ms 1.1ms 141.3MB 16ms 24ms truffleruby 24.2.1
php 1.php 48ms 2.3ms 52.2MB 18ms 20ms php 8.2.28
ruby 1.rb 52ms 0.9ms 12.8MB 40ms 0ms ruby 3.4.4
ruby 1.rb 52ms 1.2ms 12.9MB 40ms 2ms 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 3860ms 168ms 113.6MB 3810ms 33ms php 8.2.28
ruby 1-m.rb 4269ms 456ms 556.4MB 10877ms 377ms truffleruby 24.2.1
ruby 1.rb timeout 0.0ms 93.5MB 4947ms 40ms ruby 3.4.4
ruby 1.rb timeout 0.0ms 97.2MB 4933ms 50ms ruby/yjit 3.4.4

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 857ms 20ms 66.8MB 823ms 20ms php 8.2.28
ruby 1-m.rb 1985ms 41ms 547.4MB 5130ms 257ms truffleruby 24.2.1
ruby 1.rb 3266ms 10ms 38.3MB 3233ms 20ms ruby/yjit 3.4.4
ruby 1.rb 4383ms 23ms 37.6MB 4340ms 27ms ruby 3.4.4