Php’s performance improvements — HHVM, JIT, and ‘Hack’

Facebook deprecated HipHop for PHP, a PHP to C++ translator (trans-compiler) which they had been using since Feb 2010 in favour of HipHop Virtual Machine (HHVM), in 2013.

HHVM is a PHP interpreter that uses just-in-time(JIT) compilation techniques. Or to put it another way, HHVM is a virtual machine that compiles PHP bytecode to native instructions at runtime. HHVM now runs the Facebook backend instead of the default PHP interpreter.

On March 20 2014, Facebook introduced the Hack programming language for HHVM, which integrates seamlessly with PHP. Hack seems quite interesting; it’s like the good parts of PHP with some nice extras, more attuned to Facebook’s requirements. Along came a few new releases of HHVM in 2014 to improve compatibility.

In Nov-Dec 2014, Wikipedia moved its Application servers to use HHVM giving them a 2x faster load time for (uncached) page requests while drastically reducing the Load on their CPUs from 50% to 10%. Here are few more details on how Wikipedia’s move from zend to HHVM was carried out.

Image: Wikipedia’s page save time with HHVM is just 45% of what it used to be previously (

All and all, HHVM is a cool update for the PHP community. It points to a maturing platform that now powers two of world’s most visited websites. For all the flak that PHP gets, Facebook’s continued commitment has really helped the language infrastructure grow impressively.

All this triggered action in the PHP’s Zend Engine team and they have been busy updating the default interpreter. Here’s a great gist of features and improvements coming in PHP7 (also read why there’s no PHP6 on this link.) The PHP7 team are working to make the performance match up with HHVM, using JIT and Asynchronous programming support. PHP7 will probably be ready for production use by this year end.

I still love to work in Python or Go more than PHP — Python is more expressive and easier to read and navigate. But the Python 2.x Vs Python 3.x debate has done some serious damage to the language. When the Python PEP Community should have taken the path to fix some of the nagging performance and concurrency concerns, they ended up breaking the backward compatibility with a new language spec. On the other hand, Facebook/Php took the pragmatic approach of keeping things compatible with every update. This must be great news for thousands of PHP developers out there who were feeling the heat from Python, Go, and JS(Node.js).




Leave a Reply