PHP Benchmarking
I came across a few sites which have some valuable information on the “cost” of certain functions or practices in PHP. It comes in handy to keep in mind and avoid doing, and also to remember that there are better ways of doing things. If your application is coming down to relying on micro-optimization, your application itself needs to be looked at. But there’s no harm in knowing what methods take more time than others. Or of course, you can use ‘em to impress a prospective employer
- The PHP Benchmark – http://www.phpbench.com/
- lixlpixel PHP Benchmark – http://lixlpixel.org/php-benchmarks/
- Comparing all different functions and uses – http://net-beta.net/ubench/
- PHP Benchmarking Suite – http://phplens.com/benchmark_suite/
There are also some lectures and talks on optimizing:
- Speeding up PHP applications by Derick Rethans
- Simple is Hard by Rasmus Lerdorf (the creator of PHP)
- Performance by Rasmus Lerdorf
- PHP Tips & Tricks by Rasmus Lerdorf
- PHP best practices – The dos and don’ts by Tobias Schlitt & Kore Nordmann
Some good stuff there to look over and to keep in mind, especially obvious things to avoid, such as including the count() inside every for() loop. Actually any of the stuff on http://talks.php.net are a good read, and good to see where PHP has evolved from and where it’s evolving to, and to understand how to leverage the language.
To benchmark your scripts, you can use the PEAR Benchmark package; I have PEAR in my path, so for me it was as simple as including the same code that was in the examples.
[...] Read more: PHP Benchmarking [...]