The question of which PHP framework people prefer just came up again (it comes up like every three months or so) on PHP’s general mailing list. There are many considerations when it comes to selecting a framework:
- Features
- Available documentation
- Performance
- Compatibility
- Maturity and developmental progress
The specific issue I want to discuss here is performance, measured quantitatively using benchmarks.
Benchmarking any piece of software is simply a matter of timing how quickly it runs and comparing it against other pieces of software or the same piece of software under different conditions (for example, you could benchmark a PHP site using the standard MySQL extension and the Improved MySQL extension). Although one would think that a benchmark would be a fair, objective measure to use, that’s not really the case. It may be a reasonable piece of information to consider, but should never be considered absolute. For example, MySQL can create a benchmark showing how much better it performs than Oracle or SQLite. Even if such a test is simple and consistent, it’s likely that the MySQL people could fine tune the MySQL server’s performance better than they could Oracle or SQLite. In other words, such a benchmark might really be saying “these are the results you can get if you really know MySQL but don’t know as much about X”.
With all that in mind, this first benchmark suggests consistently better performance using CodeIgniter than using Zend Framework or CakePHP (although note that no framework comes close to just using PHP which doesn’t come remotely close to using just plain HTML). Also interesting to see that Ruby on Rails is close in performance to CodeIgniter, and therefore well ahead of Zend.
This next set of benchmarks suggest that the Yii framework is way, way, way better than anything else. This is on the Yii framework site! I’ve never heard of this framework but it was just formally released (version 1.0) last week. For a less biased look, check out Rasmus Lerdorf’s presentation (you may know him as the guy that created PHP in the first place). He provides raw numbers for several frameworks; lower response times and higher transaction rates are better. Once again, CodeIgniter comes in first, with Zend behind and everyone else (except for something called Solar, which came in second) behind Zend.
So there’s some hard (and soft) data on benchmarking frameworks (if you search the Web, you’ll find more). What does this actually mean, then? Well, if I were choosing a PHP framework today, I’d put CodeIgniter, Zend Framework, and maybe Solar on my list of ones to look into and cross the others off my list. My thinking is that performance is just one factor, so I’d start with those that perform best, then use the other criteria to make a final decision. On the other hand, performance is a pretty big factor, so it’s a reasonable cause to rule out badly performing frameworks, regardless of whatever other benefits they may have.