Hacker News new | ask | show | jobs
by phplovesong 2089 days ago
Mostly because PHP is implemented very poorly. Its used to be really slow (its a little bit better now with newer versions) and it always amazed me, because of its basically a thin wrapper on C.

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)

1 comments

I'll point out that in the latest Techempower Benchmarks[1] PHP makes up 20% of the fastest 25 frameworks. It also makes two appearances before the first Java framework.

PHP might not be suited to every application, but it's certainly not slow.

[1] https://www.techempower.com/benchmarks/

Thats a total BS claim. I took a quick look at the top 25, and the ones that made the list (top 25) that are PHP based are:

- 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.

I have to point out that what you say applies only on the "Fortunes" benchmark. On the others benchmarks, Java always comes before PHP. I'll also add that most people don't use the top performing frameworks (most people use Laravel and Symfony for PHP, which are near the bottom), but that applies to everything here.

[edit]: clarification

Huh? Nearly every PHP job is Laravel or Symfony nowadays, at least in Europe.
I wasn't clear, sorry. What I meant to say is that most people use Laravel and Symfony, which are nowhere near the top performing PHP frameworks on the benchmark.