Well, I got to benchmark the second framework according to my plan. ( More info about plan in the first part )
Site: https://laravel.com/
It's a very big community. The Community is growing as well as the framework is developing fast. It has a lot of different services. And There are many packages for different cases.
There is a good review here by @willian95.
Just to remind about the structure ( Full description here )
For my benchmark I took this code and made some modifications. All code committed to Github .
| framework | requests per second | relative | peak memory | relative |
|---|---|---|---|---|
| laravel-index | 9.56 | inf | 6.17 | 1.0 |
| laravel-authors | 7.23 | inf | 7.38 | 1.2 |
| laravel-categories | 6.44 | inf | 7.56 | 1.2 |
| laravel-posts | 0.00 | nan | 17.73 | 2.9 |
We see that the generation time of the initial almost empty page (laravel-index) is not very different from the time of generation of other pages. For a second, ~ 6-10 pages were generated. But the generation of the largest and most complex page - laravel-posts - all 1000 posts with information about types, authors and categories - did not meet the second.
Here it is visible that generation of page laravel-posts was carried out more than 6 seconds.
Later I will connect the service https://blackfire.io/ to profile the requests inside and find out where the delays occur.
| framework | requests per second | relative | peak memory | relative |
|---|---|---|---|---|
| phalcon-index | 309.99 | inf | 0.44 | 1.0 |
| phalcon-authors | 31.18 | inf | 0.56 | 1.3 |
| phalcon-categories | 16.80 | inf | 0.57 | 1.3 |
| laravel-index | 9.91 | inf | 6.17 | 14.1 |
| laravel-categories | 8.32 | inf | 7.56 | 17.3 |
| laravel-authors | 8.26 | inf | 7.38 | 16.9 |
| phalcon-posts | 0.07 | inf | 3.00 | 6.9 |
| laravel-posts | 0.00 | nan | 17.65 | 40.4 |
Phalcon works faster, although the page generation time has also increased, but as I suggested in a previous article, in the case of phalcon, this is similar to the complexity with mysql. Later we will find out.
Most of all I'm interested in the time of generation of a page with posts.
Phalcon-posts ~ 2.3s
Laravel-posts ~5.8s
On the one hand, the difference is only 2 times. Is this a lot or a little? It depends on the project. For a highly loaded project with millions of visitors a day, that's a lot. But in such projects, data caching is always used. In the future, I will also run tests with connected caching. And also describe the process of its inclusion.
In addition, for big queries, you need to optimize the database settings. And its updating to a newer version take effect.
But this is more difficult for me. The server part is not my strong point yet. But I'm working on it.
If there is any inaccuracy in my research - welcome to the comments.
It's also very interesting to look at the results of two more equally well-known frameworks: Yii and Symfony.
All code is committed to github: https://github.com/semasping/php_frameworks_for_tests
Thank you for your attention and your support.