3 ms·
I was surprised to see the performance of php frameworks. Has there been something special happening with this language ? It looks completely on top of all the
by bsaul 6y ago
I was surprised to see the performance of php frameworks. Has there been something special happening with this language ? It looks completely on top of all the other dynamic languages on most benchmarks, which i really don’t understand.
- open-source-ux 6y agoPHP 7.0 (which was released in Dec 2015) featured a new core with dramatic improvement in performance over PHP 5.X. PHP 8 is due for release in Dec 2020 and will feature a JIT compiler which is expected to improve performance even further. Regardless of what people think of PHP, it's nice to see the PHP community tackle performace and resource usage as a major priority. A contrast to parts of the development community who seem to care very little for performance and resource usage.
- jorams 6y agoIt's important to note that all the PHP results that are high up on the lists are using Workerman[1] with the event module, Swoole[2] or ngx_php[3]. They don't use the traditional PHP runtime model, which boots up and tears down the world for every request. Global variables, which are no problem in "normal" PHP code, are going to cause serious trouble in these environments. They are essentially gluing a very fast async IO framework to a fairly minimal amount of PHP application code. The vast, vast majority of PHP code you will find in the wild is running a more traditional stack, and those results are much lower down the list. The results are still impressive though. PHP is very good at gluing fast C code together without slowing it down much. Especially Workerman is impressive, since it appears to still run a significant amount of PHP code. [1]: https://github.com/walkor/Workerman https://github.com/walkor/Workerman [2]: https://www.swoole.co.uk/ https://www.swoole.co.uk/ [3]: https://github.com/rryqszq4/ngx_php7 https://github.com/rryqszq4/ngx_php7
- gremlinsinc 6y agoPart of that's also that php 7.4 is much faster, so of course that alone would improve it more, I wonder what JIT will do when 8.0 launches in December. I use swoole w/ laravel, still trying to figure out best ways to milk it for more performance, and also grok the way it handles async and passes variables around using swoole_Table.
- melchebo 6y agoFor the moment (well, february) the improvement with PHP 8.0 JIT is minimal: https://www.phoronix.com/scan.php?page=news_item&px=PHP-8.0-Performance-Bench-2020 https://www.phoronix.com/scan.php?page=news_item&px=PHP-8.0-... But usually a JIT is made in a way that you can then move forward with your optimizations in small tested steps. So it makes sense for JITv1 to have a very similar performance as the non-JITed version. It probably generates highly familiar code. First make it do the same, then optimize.
- Thaxll 6y agoBecause those framework are not written in PHP but C++/C library.
- joanhey 6y agoWorkerman is made with pure PHP on top of the libevent, without using a web server. It's like nodejs but in PHP.
- joanhey 6y agoPHP is fast. But the stack isn't: fast-cgi, no db pool connection, ... It's really good for a shared virtual hosting. If you change the stack with event driven, a pool and persistent application, you get that fast results.