PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

PHP 5.4 Benchmarks

Note: This article was originally published at Planet PHP on 18 July 2012.
Planet PHP

Today I'm giving my first ever talk at OSCON - about PHP 5.4 (I'll also be giving my second ever talk at OSCON, about RESTful services; it's a busy day!). My talk includes some benchmarks which I thought I'd also share here, mostly because I like pretty graphs - and this one is pretty:


This graph shows the performance of four versions of PHP (because the bench.php script that lives in the php source tree didn't appear until 5.1). The axis up the left is the time it took to run the benchmark script - so a smaller number is better news.

For each run:

  • I grabbed PHP source code for the newest version of each of PHP 5.1 through to PHP 5.4 (and then had to do that again 2 weeks later when we released new versions of PHP 5.3 and 5.4)
  • Compiled them with their "vanilla" settings - none of these versions has any extensions added or is the PHP version I actually use
  • Ran the bench.php script 10 times and collected the data (full table below)
  • Averaged the data and put it on the nice google chart

If you're interested in the raw numbers, this is what I have:

Version run0 run1 run2 run3 run4 run5 run6 run7 run8 run9 avg PHP 5.1.6 3.985 4.038 3.912 3.966 4.006 3.963 3.973 3.939 3.969 3.981 3.9732 PHP 5.2.17 4.28 4.147 4.005 4.071 4.116 4.096 4.054 4.099 4.077 4.103 4.1048 PHP 5.3.14 2.786 2.831 2.762 2.789 2.761 2.972 2.825 2.772 2.749 2.753 2.8 PHP 5.4.4 2.441 2.237 2.228 2.216 2.216 2.224 2.232 2.229 2.237 2.251 2.2511

(with thanks to textfixer.com for a CSV-html table conversion tool)

So there you have it: PHP 5.4 is measurably faster than the previous versions of PHP 5.3 (but not twice as fast). Time to upgrade?

Lorna is an independent web development consultant, writer and trainer, open source project lead and community evangelist. This post was originally published at LornaJane