Hudzilla.org - the homepage of Paul Hudson PHP and PHP
Contents > Introducing PHP > Advantages of PHP Wish List | Report Bug | About Me ]

2.2.4     Performance

NOTE: This is NOT the latest copy of this book; click here for the latest version.

Prior to the release of PHP 4, Perl mongers were more than happy to offer head-to-head tests between a PHP script and a similar Perl script, because they were safe in the knowledge that Perl outperformed PHP pretty much hands-down. However, since PHP 4, and particularly since PHP 4.1, PHP has really made big progress in terms of raw speed - in PHP 5.1 (still under development at the time of writing) speed is one of the primary areas targeted for improvement.

The change between v3 and v4 was largest, though - to give you an idea of the speed improvement, I wrote a simple test script that works in both PHP 3 and PHP 4. It simply creates an array of 1000 different random numbers, then sorts the array. When executing this script 1000 times, PHP 3 managed to achieve 19.51 requests per second on a 500MHz Linux box, compared to PHP 4's 43.08 requests per second - quite a difference, and the program was only four lines long!

So, PHP 4 performance was certainly nothing to be sniffed at. You will see a much bigger performance difference when using a more complicated script, and even higher numbers if you use one of the many PHP accelerator packages available.

Later on in the book I will be discussing how to maximise your script performance by eking out every drop of performance available.



<< 2.2.3 Output Control   2.2.5 Competing Languages >>
Table of Contents
Top-right shadow
 
Bottom-left shadow Bottom shadow