PHP is the language we all love to hate, unless you do actually love it.
I just use it to get things done and most of the time it does get the job done. But I have to agree that speed is something that is uppermost on my mind. So while I welcome the improvements that FaceBook is making to the language in the form of HACK, I think that anything that speeds up the core language is good.
What they discovered was that JIT implementation was made difficult because of the way some of the core APIs were implemented. So it became a straight choice struggle to implement a JIT in an unfavourable environment or to change the environment - and this is what the new phpng branch is all about.
It doesn't actually implement any JIT compilation, but it still manages to squeeze a 20% speed improvement on running Wordpress. All of this has been achieved using only better memory usage and better core APIs.
The technical details seem to involve changing the way that data values are stored. The Zend engine allocated all data on the heap and used a complex reference counting scheme. The new implementation stores the data structures on the stack using HashTable buckets. It seems to reduce memory use, heap allocation and to avoid the need for reference counting.
At the moment it is only an internal project and there is no suggestion that you should deploy it. You can download the code and try it out if you want to. There are also some unsupported extensions and some differences between it and PHP proper, but at the moment most of these all seem to be regarded as bugs.
There are plans for other improvements, but ultimately the goal has to be to implement JIT compilation and then presumably multi-stage JIT compilation.
The PHP group seems excited about it:
"The work on phpng, the doors it opens, the conversations it has started, the collaboration it is inspiring, are all worth getting excited about. But, we need to stay grounded, honest, and open; and say that there is much work to do in order to make the "Next Generation" a reality, this is only the start."
So it seems to be a "watch this space" situation - very STNG.
The first version of the Hollerith Electronic Computer, Britain’s first mass-produced business computer which is notable for being based on a design by Andrew Booth and featuring his magnetic d [ ... ]