Wednesday, 23 October 2019

PHP: Past and Future

We can all think of somebody who upon saying the wrong thing, maybe only once, has irreversibly ruined their reputation, possibly even after having apologised for whatever they said. Maybe it's a television presenter, or journalist of another kind, maybe it's not someone in the mainstream media but a tech-celebrity or social influence of some kind.

When an adult, especially in the public eye, says or does the wrong thing and suffers severe consequences as a result, we can all reason that adults are or should be in control of what they are saying and doing, and at bottom they deserve some consequences, though we may quibble about the severity.

When an immature mind says or does the wrong thing, nobody seeks retribution or wills punishment in the same way, whether the mind is your kin or not.

Next year, PHP will be celebrating 25 years of innovation on the web. The releases that are coming in 2020 bear no resemblance to the thing that was released all those years ago. PHP is finally a "grown up language", able to just-in-time compile user code and execute it directly on the CPU. It has a reasonably coherent object model and type system, it's the most exciting release of PHP since inception.

In the modern PHP world, when we talk about PHP, the vast majority of people can think back only as far as PHP 5, they consider PHP 5 and 7 to be the entire history of PHP, and or simply don't care about versions before it.

In the rest of the programming community, the reputation PHP has was not forged by PHP 5 or 7, versions which have seen huge improvements to almost every area of PHP, and its ecosystem, but is largely informed by PHP 4, when the web was really booming.

So today, for giggles, let's compare one aspect of PHP 4 and the upcoming PHP 8 ...

Set aside all the other improvements in the language, ecosystem, and processes used to develop the language and just focus on performance - money in other words ...

For this make-a-sort-of-point-but-otherwise-totally-useless test, I've run the Zend/bench.php script from the 7.2 branch, since it's the last version of the script that can run unmodified by the last release of PHP 4 - which is 4.4.9, released August 2008.


This is a disable all production build, with no additional extensions loaded:

The total execution time is 6.069 seconds.


This is a disable all production build, and contains a run with no extensions first (comparable to above), and one with the jit enabled:

Total execution time is 0.383 seconds without JIT and 0.108 seconds with JIT.

PHP 4 was the adolescence of PHP. PHP 5 developed the ecosystem, and PHP 7 developed the runtime and language. In PHP 8 everything comes together in a symphony of speed and impressiveness.

For those of you whose opinions are informed by an adolescent PHP, this should be enough evidence to force you to reconsider. I shouldn't have to expound the benefits of a stable release cycle, more open development process, and thriving ecosystem ... so I won't ...

I'm making this blog post some year before PHP 8 will become generally available, on purpose: I don't expect you to drop what you are doing and rewrite it in PHP, but I would hope that PHP 8 is on the radar for some upcoming project.

Peace out, future phomies ...