HHVM - Why Facebook use PHP in backend size in global scale ?

In the era, where concurrency and high-throughput traffic applications are trend, multiple high-performance language: Java, Golang is out-perform choices due to it handle multi-threads better, Facebook still used PHP as main backend language, so why ?

Let’s find out the answer.

1. Normal PHP flow

PHP source → Zend Engine → Bytecode → Interpreter executes line-by-line

2. HHVM flow

  • HHVM (HipHop Virtual Machine) was Facebook’s answer to making PHP fast enough at global scale.

  • It started as HipHop for PHP (HPHPc) — a compiler that translated PHP → C++ → machine code.

  • Then evolved into HHVM, a Just-In-Time (JIT) compiler + Virtual Machine for PHP and Hack.

PHP/Hack source → HHVM Parser → Intermediate Representation (IR)
                 ↓
           JIT Compiler → Machine Code
                 ↓
           Executed directly by CPU

  • The idea: similar to JVM engine.

3. So, whether the language is fast or not depend on compiler and intepreter ?

  • Whether a programming language is fast or slow depends a lot more on its compiler/interpreter implementation than on the language syntax itself.

  • So Facebook make PHP great by implementing the compiler for this.

Last Updated On November 5, 2025