Home  >  Article  >  Backend Development  >  What is the difference between php7 and hvvm

What is the difference between php7 and hvvm

青灯夜游
青灯夜游Original
2021-06-02 19:43:173603browse

PHP7 and HHVM parse PHP code in different ways: PHP7 uses a standard PHP parser to generate HTML code and then sends it to the client. The client displays the content expected by the user; HHVM first converts the PHP code into HipHop byte code, this code is then translated into machine code and then executed.

What is the difference between php7 and hvvm

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

What is HHVM?

In 2008, Facebook launched an effort to develop a tool to convert PHP scripts into C so that they could be compiled and run on a web server. The goal is to save server resources, an important goal because Facebook's user base is growing rapidly. In this sense, the project was successful, as it allowed the server to handle five to six times the request volume before.

Back in 2010, Facebook's server requirements had increased a lot, and it was time to consider using new innovations to improve greater efficiency. Based on this need, Facebook developed HHVM.

HHVM uses Just-In-Time (JIT) compilation to convert PHP code into some kind of bytecode. Next, the bytecode is converted into machine code and optimized to make it run as fast as possible.

What is PHP 7?

PHP 7 is the PHP community’s response to HHVM. The preview version released by PHP 7 claims to have 100% performance improvement over the previous PHP 5.

You may ask whether the version of PHP jumped directly from PHP5 to PHP7. The answer is this: the development of PHP6 started in 2005, but its progress was too slow and many problems occurred. In this way, PHP6 It had a bad reputation even before the official version was released. So the PHP community decided to directly name the new version of this language PHP7.

The real question is not a comparison between PHP5 and PHP7, because it is already obvious that PHP7 provides faster running speed. But what we want to compare is PHP7 and HHVM. Many experts have used these two methods separately to process PHP code and revealed some interesting conclusions.

Compare the similarities and differences between PHP7 and HHVM:

Before answering which one is better, let us first take a look at the key differences between them points and similarities.

Code Parsing:

The basic difference between PHP7 and HHVM is the way they parse PHP code. PHP7 uses the standard PHP parser, which is free software available to everyone and can be parsed and run directly on the server. It generates HTML code and then sends it to the client, which displays the content expected by the user.

In contrast, HHVM first converts PHP code into HipHop byte code, which is then translated into machine code and then executed. During this process, HHVM will optimize the code and optimize some PHP codes that affect execution efficiency, with the goal of improving running speed.

Writing Code

Both the PHP parser and HHVM can accept PHP code and run it. The process of writing code this way is exactly the same. But if you want to use HHVM, you need to install HHVM on your server and then call it through the HHVM command from the command line.

Performance Test:

HHVM provides faster performance than previous PHP versions. But recent performance tests suggest that PHP7 is slightly faster than HHVM, at least in some cases. Let’s take a look at the performance test results done by Kinsta:

WordPress: PHP7 running WordPress 4.1.1 can perform more than twice the requests per second than PHP5.6, but without HHVM3.6.1 Offers more, in tests HHVM performed 624 requests per second while PHP7 only performed 604.

Drupal: PHP7 can provide Drupal users with more obvious advantages than HHVM. The processing response efficiency of PHP7 on Drupal8 is more than 37 percentage points higher than that of HHVM.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What is the difference between php7 and hvvm. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn