PHP 5.3 vs 5.4 vs 5.5: Speed and memory usage

A few months ago, I did some tests regarding the memory usage of PHP 5.4 with and without Xcache, compared to 5.3. You can read the article here. My conclusion at the time is that version 5.4 indeed dropped the memory footprint by a great deal and that by itself is a huge improvement.

This time, I thought of comparing all current major stable branches of PHP, in terms of speed and peak memory usage. So, I'm comparing the latest (as of now) versions of PHP 5.3.27, 5.4.22 and 5.5.6. This time, I'm looking for numbers with regard to speed and peak memory usage, without using any accelerator (like Xcache, APC, etc.).

For the tests, I used two pages from an existing Yii project of mine, one that includes database access fetching results (DB page in chart) and one with no database access (No-DB page in chart), to come as close to a real scenario (which actually is, since I use this project in a production environment). I used the Apache ab benchmark tool to measure the requests/sec and xdebug's xdebug_peak_memory_usage() function, which returns the amount of peak memory usage during a request process. The php.ini files from the three branches had almost the same settings, so that the three PHP environments would be as close to each other as possible. The Apache configuration was the same for all three test environments. Before every test, the Apache server was restarted.

PHP 5.3 vs 5.4 vs 5.5

The left y-axis is the requests per second. The right y-axis is the peak memory usage (in KiB). The hatched bars are connected to the secondary axis, which is the peak memory consumption.


PHP 5.3 is a bit faster than 5.4 and 5.5 (approximately 7% faster than 5.4). But, from version 5.4 and upwards, the memory consumption has dropped significantly, which I guess is much more important than the small drop in performance. Versions 5.4 and 5.5 are practically the same with regards to speed and memory consumption. Not bad at all!

In any case, you don't have to stick with 5.3, which was declared End Of Life and you will have to upgrade to either 5.4 or 5.5 anyway.

The PHP language looks good!

υπολογιστές / computers: 
Χρήσιμο / Useful: 
Average: 3.5 (10 votes)
Ψηφίστε για την ποιότητα του άρθρου / Vote for the article's quality