Facebook created HHVM as a JIT-compiling PHP runtime to handle their massive scale. It evolved from HipHop (a PHP-to-C++ transpiler) into a virtual machine, then pivoted entirely to the Hack language, abandoning PHP compatibility in 2019.
HHVM is a virtual machine that uses just-in-time compilation via a custom JIT compiler (formerly LLVM-based, later replaced with a custom backend) to execute Hack (formerly PHP) code. It includes a region-based JIT that profiles running code and compiles hot paths to native x86-64 machine code, achieving performance comparable to statically compiled languages for hot code paths.
Facebook's relationship with PHP has always been complicated. The company was built on PHP — Mark Zuckerberg wrote the original Facebook in it — but by 2007, PHP's performance characteristics were becoming a serious problem at Facebook's scale. The Zend Engine simply wasn't designed to serve billions of page views efficiently.
The first attempt at a solution was HipHop for PHP (HPHPc), started in 2007 and open-sourced in 2010. HPHPc worked by transpiling PHP code to C++, then compiling that to native binaries. It achieved 6x throughput improvements over Zend PHP, but the compilation step was slow and the development experience was painful — you couldn't just edit a file and refresh the page.
In 2011, Facebook began developing HHVM (HipHop Virtual Machine) as HPHPc's successor. Rather than transpiling to C++, HHVM used a just-in-time compiler to translate PHP bytecode to native machine code at runtime. By Q1 2013, facebook.com had fully switched from HPHPc to HHVM. The performance gains were dramatic: HHVM could serve the same traffic with significantly fewer servers.
Facebook open-sourced HHVM in 2014, generating enormous excitement in the PHP community. WordPress, Wikipedia, and other major PHP applications experimented with HHVM as a drop-in replacement for the Zend Engine. For a brief moment, it looked like HHVM might become the future of PHP.
But Facebook had other plans. Alongside HHVM, they developed Hack — a gradually typed language derived from PHP with generics, async/await, and a sophisticated type system. In 2017, Facebook announced that HHVM 3.30 would be the last version supporting PHP. HHVM 4.0 (February 2019) dropped PHP entirely, running only Hack code. Meanwhile, PHP itself had caught up: PHP 7 (2015) brought massive performance improvements, and PHP 8 (2020) added a JIT compiler, largely eliminating the performance gap that had justified HHVM's existence for external users.
Facebook begins developing HipHop for PHP (HPHPc) to transpile PHP to C++
HPHPc open-sourced; claims 6x throughput improvement over Zend PHP
Development begins on HHVM as a JIT-compiling virtual machine replacement for HPHPc
Facebook.com switches entirely from HPHPc to HHVM in production
HHVM and Hack open-sourced; widespread PHP community experimentation follows
PHP 7.0 released with major performance improvements, narrowing HHVM's advantage
Facebook announces HHVM 3.30 will be the last version supporting PHP
HHVM 4.0 drops PHP support entirely, running only the Hack language
HHVM's greatest impact was arguably not on itself but on PHP. The existence of a dramatically faster alternative lit a fire under the PHP internals team, leading to PHP 7's performance revolution (2-3x faster than PHP 5.6) and eventually PHP 8's JIT compiler. In a sense, HHVM succeeded by making itself unnecessary for everyone except Facebook.
Within Facebook (now Meta), HHVM and Hack remain central to the company's infrastructure, running one of the largest codebases in the world. The Hack language's type system and async primitives influenced the broader PHP community's adoption of similar features.