Hacker News new | ask | show | jobs
by deepstack 1353 days ago
Being use PHP when it was Personal Home Page, also dropped out since PHP5 to node and now deno. Wonder what changed in 7 that makes it worth at look again now days.
1 comments

7 brought a huge speed boost. (typically 100% or more without any code change required).

Not specific to 7, but 2 things I think have helped a lot are:

* PSR standards * composer packaging

Initial PSR work helped define some package interop standards. I'm not sure how useful ongoing PSR work today is (no doubt there's some incremental benefits?).

Composer is a great package manager, and helped usher in a lot more sharing/reusability of common components.

Laravel bundles a number of Symfony components, for example (many frameworks do).

The speed alone in 7 was big, and we've seen some more incremental improvments in 8 and 8.1 and 8.2. It's hard to find current benchmarking tools that compare the 5 series with 7 and 8. I found one showing 5->7 on a mandelbrot run.

* PHP 5.0 was 251s

* PHP 5.1 was 87s

* PHP 5.6 was 29s

* PHP 7.0 was 15s

* PHP 7.1 was 9s

The 'experimental JIT' work (at that time) yielded 4s.

That benchmark was from 2016, so... way out of date now, but other numbers I've seen were 7.1->7.4 was another ... 10% improvement on average, and depending on workload, you might see another 10-20% improvement from 7.4->8.0.

Kinsta has some interesting useful benchmarks on 'real world' apps

https://kinsta.com/blog/php-benchmarks

Been using PHP since 1996, and ecosystem, community, performance all continuously improve year over year.

Wow, that's pretty impressive especially with no code changes! Thanks for the breakdown and for sharing!
You're welcome. Much of the speed bump in 7 came from reworking internal memory usage and allocation. A pointer for an array entry used to be 128 bytes - each array entry had a 128 byte overhead. It was reworked and refactored down to... 42? or 44? You can probably imagine the impact that might have on memory allocation.