What makes a PHP version implemented in a JVM 9x faster than PHP implemented in C?
What makes a PHP version implemented in a JVM 9x faster than PHP implemented in C?
PHP 8 also introduces a JIT compiler, which is presumably less mature but more complete: https://wiki.php.net/rfc/jit
It's easy being faster when you're doing less.
A majority of the dynamic compilation research goes into JVMs. (The remainder being apportioned mostly to the javascript vms and the clr, with mike pall waving his luajit hat in the distance.)
An overwhelming majority of GC research also goes into JVMs, thanks to Jikes RVM.
Ever seen a java Spring project start in 0.015s, or a java rest service living in 16-32mb of ram? With graal these things are now possible.
The kind of things they are benchmarking aren't what people typically use PHP for.
I guess PHPs core types are very inefficient and the team behind PHP lacks time to really do a rewrite. A prime example is the PHP "array". Its not a list, its not an array, but more of a weird object thing. PHP is full of these weird things that are probably hard to optimize (in the PHP runtime)
PHP might not be suited to every application, but it's certainly not slow.
[edit]: clarification
- 11: php-ngx-pgsql
- 12: workerman-pgsql
- 22: workerman
- 23: php-ngx-mysql
- 25: Swoole
Here you see a trend, workerman and swoole are BOTH nodejs clones, they have a event loop and are non-blocking. This means you CANNOT use 95% of core PHP because its blocking by nature. These are all a non-starter for 99.9% of PHP based apps. Also swoole is a PHP C-extension, not a "installable" framework like say Symfony is, taht said these are NOT frameworks at all, not sure why they are on the list?
Heres the REAL rankings of the PHP frameworks that are used in the wild:
- 299: codeigniter
- 323: fatfree
- 369: cakephp
- 370: symfony
- 377: laravel
PHP occupies the lower bottom of the ranking, and will probably always be there becuase og how PHP is built. The core model of execution is always going to be slower than a "running" program. This is evident with the nodejs clones.