PHP 7 vs HHVM

Source: Internet
Author: User
Tags hhvm

What is HHVM?

In 2008, Facebook launched a project to develop a tool that translates PHP scripts into C + + so that it can be compiled and run on the Web server. The goal is to conserve server resources, which is an important target because Facebook's user volume is growing rapidly. In this sense, this project is successful because it allows the server to handle the volume of requests five to six times times before.

As time goes back to 2010, Facebook's server needs have increased, and it is time to consider new innovations to improve efficiency. Based on this demand, Facebook has developed HHVM.
HHVM uses the Just-in-time (JIT) compilation method to convert PHP code into some kind of byte code. Next, convert the bytecode into machine code and optimize it to run as fast as possible.


What is PHP 7?

PHP 7 is the PHP community's response to HHVM. PHP 7 released a preview version claiming that the performance of the previous PHP 5 was increased by 100%.

you might ask the PHP version to jump directly from PHP5 to PHP7, and the answer is this: PHP6 's development began in 2005, but it's been too slow and a lot of problems, so PHP6 has a bad reputation before it has yet to release the official version. So the PHP community decided to name the new version of the language directly as PHP7.
The real problem is not the comparison between PHP5 and PHP7, as it is already clear that PHP7 provides a faster run. But what we want to compare is PHP7 and HHVM. Many experts have used these two methods to deal with PHP code, and have revealed some interesting conclusions.


PHP7 cache has opcode,

The HHVM cache has bytecode (HHBC is hiphop bytecode).


PHP7 does not introduce JIT,PHP7 performance improvements in the use of better memory structure, such as on the stack for zval allocation of memory instead of PHP5 on the heap allocation, direct operation Zval Replace the PHP5 with (level two) pointer operation, reduce memory allocation cycle. The number of CPU instructions used by PHP7 to perform WordPress is approximately 1/4 of PHP5, and the number of CPU instructions for the computationally intensive bench.php can be reduced by more than half. http://rango.swoole.com/archives/440


HHVM is a single-process service with multiple threads, unlike PHP-FPM, which has 1 main processes and multiple worker processes (Nginx is also the process model), which means that HHVM cannot be automatically recovered because of a thread problem crash or zombie. The PHP-FPM master process can restart the worker process. Baidu turn HHVM encountered problems: Crash/memory leak/compatibility/deadlock/performance (JIT warm-up/no trigger JIT). http://lamp.baidu.com/2014/11/04/hhvm-in-baidu/

PHP 7 vs HHVM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.