Benchmarks: PHP, Perl, Python, Python3 and Ruby

Hello, guys,

It's been a while since I wrote anything in english. I want to share this simple benchmark with you. It is a simple one: print a message; followed by a number; one million times.

This is the perfect benchmark since it benchmarks the language itself. It does everything it should do in order to give you a baseline and a proper comparison. I am not using fancy printing operations or anything.

Here is the output:

# make all
time php one_million.php > /dev/null

real        0m0.609s
user        0m0.479s
sys 0m0.127s

time perl > /dev/null

real        0m0.219s
user        0m0.215s
sys 0m0.003s

time python > /dev/null

real        0m0.870s
user        0m0.845s
sys 0m0.019s

time python3 one_million.py3 > /dev/null

real        0m2.691s
user        0m2.671s
sys 0m0.010s

time ruby one_million.rb > /dev/null

real        0m0.894s
user        0m0.885s
sys 0m0.005s

How to run it

Specs (kind of)

  • Fedora 17 x86_64
  • AMD Phenom(tm) II X6 1100T Processor
  • 16GB DD3 RAM @ 1600 MHz
  • 4 SATA 2 HDD (LVM and Ext4 for now)