PHP7 vs HHVM

PHP is one of the most popular scripting languages for web development. Its latest version, PHP 7, has significant performance optimizations. However, PHP has a competitor — HHVM (HipHop Virtual Machine). The comparison is heating up, so let’s look at their performance.

What is HHVM?

In2008, Facebook started a project to develop a tool that converts PHP scripts to C++, which can be compiled and run on web servers. The goal was to save server resources — critical given Facebook’s rapid user growth. The project succeeded, allowing servers to handle 5-6x more requests.

Fast forward to 2010 — Facebook’s server demands had grown significantly. It was time for innovation to improve efficiency. This led to HHVM.

HHVM uses Just-In-Time (JIT) compilation to convert PHP code to bytecode, then to optimized machine code for maximum speed.

What is PHP 7?

PHP 7 is the PHP community’s response to HHVM. Preview versions claim performance100% improvement

Why skip from PHP5 to PHP7? PHP6 development started in 2005 but was too slow and problematic, gaining a bad reputation before release. So the community named the new version PHP7.

The real question isn’t PHP5 vs PHP7 — PHP7 is clearly faster. We want to compare PHP7 vs HHVM. Experts have tested both and revealed interesting conclusions.

Comparing PHP7 and HHVM:

Before answering which is better, let’s examine their key differences and similarities.

Code Parsing:

The basic difference is how they parse PHP code. PHP7 uses the standard PHP parser — free software that parses and runs directly on the server, generating HTML for the client.

In contrast, HHVM first converts PHP to HipHop bytecode, which is then translated to machine code and executed, optimizing for speed.

Writing Code

Both PHP parser and HHVM accept PHP code. The coding process is identical. To use HHVM, install it on your server and invoke via command line.

Performance Testing:

HHVM offers faster performance than older PHP versions. But recent tests suggest PHP7 is slightly faster in some cases. Let’s look at Kinsta’s benchmarks:

  • WordPress: PHP7 on WP 4.1.1 serves over 2x more requests/sec than PHP5.6, but slightly less than HHVM 3.6.1 (624 req/s for HHVM vs 604 for PHP7).

  • Drupal: PHP7 offers Drupal users a more significant advantage — 37% better response efficiency than HHVM on Drupal 8.

Which Companies Use HHVM?

Besides Facebook, many companies use HHVM for PHP apps, including Wikimedia and e-commerce site Etsy.

  • Wikimedia: HHVM can load multiple CPU cores simultaneously (vs PHP’s single-thread). After deploying HHVM, CPU load dropped from 50% to 10%, edit response time halved, page load from 1.3s to 0.9s.
  • Etsy: With 54 million users, Etsy compared HHVM vs PHP5.4. HHVM handles 280 req/s vs PHP5.4 which degrades rapidly beyond 190 req/s.

Future of PHP7 vs HHVM

PHP7 stable releases November 2015. Though companies haven’t adopted it yet, promising benchmarks will attract more to the new version.

The future belongs to PHP7. HHVM is dying. Though many enterprises use HHVM, the transition back to PHP won’t be instant. Etsy took over six months. HHVM only has a slight speed advantage over PHP7, so enterprises will switch back to PHP.

Facebook continues developing HHVM, recently adding Mac OS X support. HHVM developers believe it’s still faster than PHP7 in many cases, including WordPress.

Why HHVM vs PHP 7 Matters for Online Store Owners

As a store owner, choose based on your platform. If using WordPress, check the latest HHVM vs PHP7 benchmarks to minimize page load time, server response, and CPU usage.

Reasons to Choose HHVM

  • HHVM uses dynamic translation for higher performance in most cases (including WordPress).

  • HHVM ensures low memory per request when handling high volumes.

  • HHVM developers steadily increase compatible PHP code — it now runs latest WordPress and common PHP frameworks.

  • HHVM is open source — anyone can use and modify its source code.

Reasons to Choose PHP 7

  • PHP 7 is faster than HHVM in some cases, including Drupal 8.

  • PHP 7 doesn’t require HHVM installation.

  • Though many PHP 4 features are dropped, PHP 5 code will work as expected on PHP 7.

  • PHP 7 is developed by the PHP community, renowned for stable, reliable PHP versions.

HHVM vs PHP 7: Make Your Choice

Don’t hesitate too long. Kinsta suggests choosing between PHP7 and HHVM and implementing early for optimized performance. An inefficient website damages your reputation.

Both HHVM and PHP 7 are beneficial over older PHP. Decide and migrate your site soon.

 

 

Leave a Comment

Your email address will not be published.