5 ms·
It'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
by jorams 6y ago
It'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.