Personally, I've found the biggest performance improvement comes with instantiating classes. I don't understand the internals well enough to explain, but in profiling, I've always seen significant improvements.
> You may already know that PHP, C++, Swift, and any other modern programming language is not communicating directly to the hardware. The programming language is just an easier way to talk to the machine. The machine native language is still binary code.
> One way or another, each programming language is translated to the binary code by using the compiler. PHP is no different. But what makes it unique is a Just in Time engine, that allows compilation of the code during the execution of the program. This principle is also known as dynamic translation.
I mean, I guess this weird explanation is fine for a php consultant, but honestly I wouldn't trust any results presented next a description this wrong.
The first part is kind of baffling. I'm not even sure what is trying to be said there. English as a second language?
The second one if actually wrong unless something changed very recently, PHP is not JIT compiled (at least not to machine code). It is a bytecode VM. I remember the discussion came up and optimizing the byte code was actually improved performance more than proof of concept JIT did for common PHP use cases.
Not to be overly dismissive, but this article is just... weird?
The arguments for why switch are pointless, no mention of the actual benefits. Statements like "Hopefully, JIT was integrated into PHP 7", and a very special explanation of compilation and jit. It makes me not trust anything written here.
The person writing this has no idea about what he's talking about, so you're not the only one finding it untrustworthy.
Seriously, how can a person call himself a "PHP guru" and at the same time tell people that it's faster as a result of JIT compilation when PHP doesn't use JIT compilation? Amazing.
This article is non-sense from a technical point of view: there are so few details on what is tested, on which conditions, ...
There for example is no mention of the php7 version tested: 7.0? 7.1? 7.2? No version of hhvm either. No clear details on what the tested code does: what kind of setup/options is used, which Wordpress page(s) is actually called. How much memory the machine has, how php is configured regarding the opcache, ...
Also, why posting this to HN now? Php 7 has been released more than 2 years ago, those improvements have been discussed a long time ago.
18 comments
[ 2.8 ms ] story [ 43.3 ms ] threadhttp://php.net/supported-versions.php
> One way or another, each programming language is translated to the binary code by using the compiler. PHP is no different. But what makes it unique is a Just in Time engine, that allows compilation of the code during the execution of the program. This principle is also known as dynamic translation.
I mean, I guess this weird explanation is fine for a php consultant, but honestly I wouldn't trust any results presented next a description this wrong.
The second one if actually wrong unless something changed very recently, PHP is not JIT compiled (at least not to machine code). It is a bytecode VM. I remember the discussion came up and optimizing the byte code was actually improved performance more than proof of concept JIT did for common PHP use cases.
PHP 8 is supposed to have a JIT I believe.
The arguments for why switch are pointless, no mention of the actual benefits. Statements like "Hopefully, JIT was integrated into PHP 7", and a very special explanation of compilation and jit. It makes me not trust anything written here.
Seriously, how can a person call himself a "PHP guru" and at the same time tell people that it's faster as a result of JIT compilation when PHP doesn't use JIT compilation? Amazing.
"PHP guru"
PHP doesn't use JIT compilation...
There for example is no mention of the php7 version tested: 7.0? 7.1? 7.2? No version of hhvm either. No clear details on what the tested code does: what kind of setup/options is used, which Wordpress page(s) is actually called. How much memory the machine has, how php is configured regarding the opcache, ...
Also, why posting this to HN now? Php 7 has been released more than 2 years ago, those improvements have been discussed a long time ago.