This page shows benchmarks comparing the following PHP frameworks:
Note: CakePHP 2.1.1 is still in the works, but having issues with caching. I will update the results once those are sorted out.
The results are measured in requests/second.
The test is a simple ""Hello World"". While this doesn't test many aspects of a framework (I plan on adding additional tests for the database layer and template rendering in the future), it does test the overhead the framework itself adds with its front controller, bootstrapping, request routing, and how well each framework makes use of APC. This makes it a decent measure for evaluating what cost each framework adds to the core of a project.
The test machine is a MacBook Pro with the following specs:
Mac OS X 10.7.3 2.53 GHz Core i5 w/ 8 GB RAM Apache 2.2.21 PHP 5.3.8
I forked the phpmark benchmarking tool that adds the additional frameworks. The forked code is here:
For Symfony2, I used the Symfony Project's own version optimized for Hello World style tests.
Additionally, paths were modified in the
benchmark.sh script to adjust the paths for Mac OS X, specifically:
# Change the following settings if needed BENCH_INIT=""/usr/sbin/ab -n 5""; BENCH_EXEC=""/usr/sbin/ab -t 30 -c 10"" CURL_EXEC=""/usr/bin/curl"" HTTP_START='sudo /usr/sbin/apachectl start' HTTP_STOP='sudo /usr/sbin/apachectl stop'
Here is a chart of the results of the test:
Note: Higher numbers are better.
And here is a table of the actual numbers:
|Req/s - APC off||Req/s - APC on||Winners|
Some notes about the tests:
I'm still working on updating CakePHP to 2.1.1, but I'm running into issues with its caching. I will update the test results for it as soon as those are sorted out.
ab runs into socket limits on Mac OS X leading to to the following error message:
apr_poll: The timeout specified has expired (70007)
Turning KeepAlive off doesn't fix it, but this only happens for the baseline tests, which we aren't as concerned about here.
Elefant comes out on top with a small lead over FatFree. CodeIgniter comes in third with a large boost with APC enabled.
Yii and Laravel are on the upper end of the middle, with Yii almost matching CodeIgniter with APC enabled, while Laravel doesn't seem to benefit as much from APC caching. FuelPHP and Kohana round out the middle.
Symfony 2 improves over 1.4, but still lags substantially behind, along with CakePHP, Silex, and Zend. The surprising one to me was Silex, which I expected to be faster. I suppose it's the cost of parsing the .phar file format. APC didn't provide much improvement for it either.
As you can see, there is a substantial variance in performance between the different frameworks, with the winner being almost 7 times faster than the slowest framework. I hope this information is useful in helping each framework's developers to consider ways they might improve their performance in future releases.
For more benchmarks, see: