Latest Version PHP 7 vs HHVM Multi-angle comparison, vshhvm_php tutorial

Source: Internet
Author: User
Tags hhvm drupal

Latest Version PHP 7 vs HHVM Multi-angle comparison, VSHHVM


PHP is one of the most popular scripting languages for Web development. The latest version of PHP, PHP 7, has done a great job of optimizing performance. However, PHP also has a rival HHVM (HipHop virtual machine)-a dummy tool that runs PHP code. The direct comparison is heating up, so let's take a look at their direct performance comparisons.

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.

Compare the similarities and differences between PHP7 and HHVM:

Before answering any better, let's take a look at the key differences and similarities between them.

Code parsing:

The basic difference between PHP7 and HHVM is the way they parse the PHP code. PHP7 uses a standard PHP parser, which is a free software that can be used by everyone, and can be parsed and run directly on the server. It generates HTML code, which is then sent to the client, and the client displays what the user expects.

By contrast, HHVM first translates the PHP code into a HipHop byte code, which is then translated into machine code and executed. In this process, HHVM will optimize the code to optimize some PHP code that affects execution efficiency, with the goal of increasing the speed of operation.

Write code:

PHP parsers and HHVM can both receive PHP code and run it. The process of writing this code is exactly the same. But if you want to use HHVM, you need to install HHVM on your server and then call it by HHVM command on the command line.

Performance test:

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

WordPress: PHP7 running in WordPress4.1.1 can execute more than twice times per second than PHP5.6, but no HHVM3.6.1 provides much, in the test HHVM executes 624 requests per second and PHP7 only executes 604.

DRUPAL:PHP7 can provide Drupal users with a more obvious advantage than HHVM. The response efficiency of PHP7 on Drupal8 is more than 37% higher than that of HHVM.

What companies use HHVM?

In addition to developing HHVM's FaceBook company, there are many other companies that have adopted this scheme to run PHP applications on servers with HHVM, including Wikimedia and e-commerce website Etsy.

Wikimedia:wikimedia has a wealth of educational content, including the famous online encyclopedia Wikipedia. Wikipedia attracts nearly 500 million internet users every month, in order to meet such advanced requirements, the need to optimize server performance, and PHP compared to HHVM has a significant advantage, it can load multiple SPU core at the same time, PHP is a single-threaded language, can not be parallelized. After Wikipedia deployed the HHVM, the CPU load dropped from 50% to 10%, the average response time for user submissions was reduced to half the original, and the average load time of the page dropped from the original 1.3 seconds to 0.9 seconds.

Etsy: With 54 million users, Tesy also urgently needs to improve server performance, Etsy engineers compared HHVM and PHP5.4 performance, found that HHVM can handle 280 server requests per second, and for PHP5.4, if the number of requests per second exceeds 190 times, the response time of the server will increase sharply.

What are the prospects for PHP 7 and HHVM?

Since the stable version of PHP 7 will be released in November 2015, no company is currently using the new language, and since the beta version of PHP 7 is performing well in benchmarking, it will attract more companies to use PHP 7 in the future.

The future of PHP is bright, so what about HHVM? It will probably continue to live very well. Many companies have used HHVM in their websites to improve performance, and migrating between PHP and HHVM is not an overnight move. Etsy spent at least 6 months. Because PHP7 and HHVM do not perform as well as they do, those companies are unlikely to be eager to switch to PHP.

Facebook will still continue to develop HHVM. It recently announced support for Apple's operating system, enabling developers working in Apple's development environment to use the technology. HHVM developers believe that in many cases HHVM is faster than PHP7, including worldpress.

Why do HHVM and PHP 7 have a competitive relationship with shop owners?

As an online shop owner, you need to decide whether to use PHP7 or HHVM based on the platform on which your online store is located. If your site is created with worldpress, then you can look at the latest version of the HHVM and PHP 7 benchmark results, from the test results can find the difference in performance, then you can choose a solution to minimize page load time, server response time and CPU Usage rate.

Reasons to choose HHVM

HHVM uses dynamic translation technology, which in most cases (including WordPress) can provide higher performance.

HHVM can ensure that only a small amount of memory is used per request when processing a large number of requests.

HHVM developers are steadily increasing the number of PHP code that the engine can run, which is already running the latest version of Worldpress, as well as other common PHP frameworks and applications.

HHVM is open source, and although HHVM is developed by Facebook, it is open source, meaning that anyone can use and modify its source code.

Reasons to choose PHP 7

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

Using PHP 7 does not require installation settings HHVM.

Although many PHP 4 features are no longer supported in the new version, code written in PHP 5 will work as expected after switching to PHP 7.

PHP 7 was developed by the PHP community, a group of people who developed a stable and reliable version of PHP.

HHVM vs. PHP 7: Make your choice

Don't hesitate too long, Kinsta suggests that online sites try to choose between PHP 7 and HHVM, start implementing solutions early, and optimize your site's performance. An inefficient website will also damage your reputation, and it will be hard to undo.

Articles you may be interested in:

    • migrating PHP versions to PHP7
    • PHP7.0 Version Notes
    • PHP7.0 Installation Notes Finishing
    • On the important new characteristics of PHP7
    • PHP7 full version of the test, performance amazing!
    • Talk about PHP7 new features
    • PHP7 's MongoDB API use detailed

http://www.bkjia.com/PHPjc/1099066.html www.bkjia.com true http://www.bkjia.com/PHPjc/1099066.html techarticle Latest Version PHP 7 vs HHVM Multi-angle comparison, VSHHVM PHP is one of the most popular scripting languages for Web development. The latest version of PHP, PHP 7, has done a great job of optimizing performance. However, ...

  • 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.