Php VS Ruby benchmarks

Current benchmark data was generated on Fri Aug 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 1486ms 2574ms 801.2MB 6400ms 613ms truffleruby 24.2.2
ruby 1.rb 4961ms 19ms 109.4MB 4863ms 83ms ruby/yjit 3.4.5
php 1.php timeout 0.0ms 141.5MB 4970ms 20ms php 8.2.29
ruby 1.rb timeout 0.0ms 70.0MB 4943ms 43ms ruby 3.4.5

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 504ms 1.1ms 20.3MB 480ms 10ms ruby/yjit 3.4.5
ruby 1-m.rb 528ms 58ms 407.2MB 1043ms 157ms truffleruby 24.2.2
php 1.php 618ms 4.3ms 62.6MB 587ms 17ms php 8.2.29
ruby 1.rb 932ms 5.8ms 19.5MB 913ms 7ms ruby 3.4.5

helloworld

Input: QwQ

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
ruby 1.rb 35ms 0.6ms 141.9MB 12ms 28ms truffleruby 24.2.2
php 1.php 48ms 1.4ms 52.2MB 18ms 20ms php 8.2.29
ruby 1.rb 50ms 0.8ms 12.8MB 36ms 4ms ruby 3.4.5
ruby 1.rb 51ms 1.7ms 13.0MB 36ms 4ms ruby/yjit 3.4.5

merkletrees

Input: 17

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 3710ms 17ms 113.8MB 3673ms 27ms php 8.2.29
ruby 1-m.rb 3864ms 19ms 565.6MB 9860ms 350ms truffleruby 24.2.2
ruby 1.rb timeout 0.0ms 94.1MB 4937ms 47ms ruby 3.4.5
ruby 1.rb timeout 0.0ms 94.8MB 4940ms 50ms ruby/yjit 3.4.5

Input: 15

lang code time stddev peak-mem mem time(user) time(sys) compiler compiler/runtime
php 1.php 828ms 8.5ms 66.8MB 793ms 23ms php 8.2.29
ruby 1-m.rb 2027ms 88ms 571.0MB 5207ms 273ms truffleruby 24.2.2
ruby 1.rb 3296ms 19ms 38.3MB 3260ms 20ms ruby/yjit 3.4.5
ruby 1.rb 4401ms 19ms 37.8MB 4363ms 20ms ruby 3.4.5