开源中国

我们不支持 IE 10 及以下版本浏览器

It appears you’re using an unsupported browser

为了获得更好的浏览体验,我们强烈建议您使用较新版本的 Chrome、 Firefox、 Safari 等,或者升级到最新版本的IE浏览器。 如果您使用的是 IE 11 或以上版本,请关闭“兼容性视图”。
PHP 7 vs HHVM 比较 - 开源中国社区
当前位置:技术翻译 »  Web/WAP应用开发 »  中英文对照

PHP 7 vs HHVM 比较

英文原文:PHP 7 vs. HHVM Comparison

PHP is one of the most popular scripting languages used for web development. The latest version of PHP, PHP 7 is a new version of the language that is been optimized for fast performance. However, PHP has a rival in HHVM (HipHop Virtual Machine) — a virtual tool that executes PHP code. The competition between these two options is heating up, so let’s take a look at the performance that each can offer.

What is HHVM?

In 2008, Facebook started working on a tool to convert PHP script into C++ so it could be compiled and executed on web servers. The aim was to conserve server resources, an important goal, as Facebook’s user base was growing rapidly. In this sense, the project was a success; it allowed the server to accommodate between five and six times more traffic than it had managed before.

译者信息

译者信息

zicode
zicode
翻译于 2年前

5 此译文

其它翻译版本:1(点击译者名切换)
ChappaKo

PHP 是最流行的用于 web 开发的脚本语言之一。PHP 的最新版本,PHP 7 在性能上做了很大的优化。不过,PHP 还有一个竞争对手 HHVM (HipHop Virtual Machine) — 一个运行 PHP 代码的虚拟工具。二者直接的比较正在升温,那么让我们来看一下他们直接的性能对比吧。

什么是 HHVM?

2008年,Facebook 启动了一项工作,计划开发一个工具 将 PHP 脚本转换成 C++,这样就可以被编译后在 web 服务器上运行。目的是节省服务器资源,这是一个很重要的目标,因为 Facebook 的用户量正在快速增长。从这个意义上讲,这个项目是成功的,因为它可以让服务器处理之前五到六倍的请求量。

Fast-forward a couple years to 2010. Facebook’s server needs had grown even more, placing it in a position to require another innovation to allow it to operate more efficiently. In response to this demand, Facebook developed the HipHop Virtual Machine (HHVM).

HHVM uses Just-In-Time (JIT) compilation to convert PHP code into a type of bytecode. It then converts this bytecode into machine code and optimizes it so that it runs as quickly as possible.

What is PHP 7?

PHP 7 is the PHP community’s response to HHVM. Early announcements of the launch of PHP 7 claimed that it would offer better than 100 percent performance improvements over the previous version of the language, PHP 5.

译者信息

译者信息

zicode
zicode
翻译于 2年前

2 此译文

时间回到2010年,Facebook 的服务器需求已经增加了很多,是时候考虑用新的创新来提升更大的效率。基于这个需求,Facebook 开发了 HHVM。

HHVM 使用了 Just-In-Time (JIT) 编译方式将 PHP 代码转换成某种字节码。接下来把字节码再转换成机器码并进行优化,让它尽可能快的运行。

什么是PHP 7?

PHP 7 是 PHP 社区对 HHVM 的回应。PHP 7 发布的预览版本号称比之前的 PHP 5 的性能要提升100%

You might be wondering why PHP skipped version 6. The answer is that development on PHP 6 began in 2005, but it went on so long and ran into so many problems that PHP 6 had developed a bad reputation long before it was ready for release. As a result, the PHP community decided to skip the name PHP 6 and go straight to PHP 7 for the new working version of the language.

The real question is not how PHP 7 compares to PHP 5, as it is pretty clear that PHP 7 offers speedier performance. Instead, the consideration is how PHP 7 compares to HHVM. Many experts have conducted tests on the two ways of handling PHP code, which have revealed some interesting results.

译者信息

译者信息

josephyu
josephyu
翻译于 2年前

2 此译文

你可能会问 PHP 的版本直接从 PHP5 跳到了 PHP7,答案是这样的:PHP6 的开发开始于2005年,但是它的进展过于缓慢又出现了很多的问题,这样 PHP6 在它还没有发布正式版本之前就有了不好的名声。所以PHP社区决定给这个语言的新版本直接命名为 PHP7。

真正的问题不是 PHP5 和 PHP7 之间的比较,因为已经很明显了 PHP7 提供了更快速的运行速度。但是我们想比较的是 PHP7 和 HHVM。很多专家已经分别使用了这两个方法来处理PHP代码,并且揭示了一些有趣的结论。

PHP 7 vs. HHVM: Similarities and Differences

Before answering the “which is better” question, let’s take a look at the key differences between PHP 7 and HHVM, as well as the ways in which they are similar.

Code Interpretation

The fundamental difference between PHP 7 and HHVM is the way in which each one interprets PHP code. PHP 7 uses the standard PHP interpreter, free software that is available for anyone to use, to directly interpret and execute PHP code on the server. This generates HTML code, which is then sent to the client. The client then displays the desired content to the web user.

In contrast, the Hip Hop Virtual Machine first converts PHP code into HipHop bytecode. This code is then translated into machine code and executed. Some optimization takes place during this translation, ironing out inefficiencies in PHP code with the aim of delivering faster performance.

译者信息

译者信息

josephyu
josephyu
翻译于 2年前

1 此译文

比较 PHP7 和 HHVM 的异同:

在回答哪个更好之前,让我们先来看一下他们之间的关键不同点和相似之处。

代码解析:

PHP7 和 HHVM 之间的基本不同之处在于他们解析 PHP 代码的方式。PHP7 使用标准的 PHP 解析器,它是一个可以给所有人使用的免费软件,可以在服务器上直接解析和运行。它生成 HTML 代码,然后发送给客户端,客户端显示出用户期望的内容。

相比之下,HHVM 首先把 PHP 代码转化为 HipHop 字节代码,这个代码再被翻译成机器码然后执行。在这个过程中 HHVM 会对代码进行优化,优化一些影响执行效率的 PHP 代码,目标是提高运行速度。

Writing Code

Both the PHP interpreter and HHVM take PHP code and execute it. Therefore, the process of writing the code is pretty much the same in each case. However, if you want to use HHVM, you need to install it on your server and then call it using the hhvm command on the command line.

Benchmark Testing

HHVM has offered much faster performance than previous versions of PHP. However, recent benchmark tests suggest that PHP 7 is slightly faster than HHVM, at least in some situations. Let’s take a look at the results of some benchmark testingconducted by Kinsta.

  • WordPress: Running on WordPress 4.1.1, PHP 7 allows more than twice as many requests to be executed per second as PHP 5.6. However, it still doesn’t process quite as many as HHVM 3.6.1, which executed 624 requests per second in the test compared to just 604 executed each second by PHP 7.

  • Drupal: PHP 7 offers a distinct advantage over HHVM for Drupal users. PHP 7 can handle 37 percent more server requests per second compared to HHVM on Drupal 8.

译者信息

译者信息

josephyu
josephyu
翻译于 2年前

2 此译文

编写代码

PHP 解析器和 HHVM 都可以接收 PHP 代码然后运行。这样写代码的过程是完全一样的。但是如果你想使用 HHVM,你需要在你的服务器上安装 HHVM 然后以命令行的方式通过 HHVM 命令来调用。

性能测试:

HHVM 比之前的 PHP 版本能提供更快速的性能。但是最近的性能测试认为至少在某些情况下 PHP7 是比 HHVM 稍微快些。让我们来看一下由 Kinsta 来做的性能测试结果:

  • WordPress:运行在WordPress4.1.1的 PHP7 每秒钟比 PHP5.6 能执行超过两倍的请求,但是没有 HHVM3.6.1 提供的多,在测试中 HHVM 每秒钟执行624个请求而 PHP7 只执行604个。

  • Drupal:PHP7 可以给 Drupal 用户提供比 HHVM 更加明显的优势。PHP7 在 Drupal8 上的处理响应效率比 HHVM 高出超过37个百分点。

Which Companies Use HHVM?

In addition to Facebook, which developed HHVM, many other businesses have adopted this solution to running PHP applications on their own servers. These include Wikimedia and the e-commerce site Etsy.

  • Wikimedia: Wikimedia hosts a huge range of educational content, including the famous Wikipedia online encyclopedia. Attracting nearly half a billion Internet users each month, Wikimedia needs to optimize server performance to cope with its high level of demand. HHVM poses a significant advantage over PHP in that it can load multiple SPU cores simultaneously whereas PHP is a single-threaded language that can’t be parallelized. According to Wikimedia, deploying HHVM shrank CPU load from 50 to just 10 percent, halved the mean time taken to respond to users submitting edits and reduced the average page load time from 1.3 seconds to just 0.9 seconds.

  • Etsy: With 54 million users, Etsy’s servers also face significant demands. Etsy engineers compared HHVM to PHP 5.4 and found that HHVM could cope with up to 280 server requests per second whereas the response time of PHP 5.4 started to dramatically increase once the number of requests grew beyond 190 per second.

译者信息

译者信息

听取新翻杨柳枝
听取新翻杨柳枝
翻译于 2年前

1 此译文

那些公司使用 HHVM?


除了开发出 HHVM 的 FaceBook 公司外,还有很多其他公司也采用了这个方案,在服务器上用 HHVM 运行 PHP 应用,包括 Wikimedia 和电子商务网站 Etsy。

  • Wikimedia:Wikimedia 拥有大量的教育内容,包括著名的在线百科全书维基百科。维基百科每 个月吸引着近五亿的互联网用户,为了满足这样高级的需求,需要优化服务器的性能,和 PHP相比 HHVM 有一个显著的优点,它可以同时加载多个 SPU 核心, 而 PHP 是单线程语言,不能被并行化。维基百科部署了 HHVM 后,CPU 的负载从50%降到了10%,用户提交编辑时的平均响应时间减少到原来的一半,页面的平均加载时间从原来的1.3秒降到了0.9秒。


  •  Etsy: 拥有五千四百万用户的 Tesy 同样迫切需要提高服务器性能,Etsy 的工程师对比了HHVM 和 PHP5.4 的性能,发现 HHVM 每秒可以处理280个服务器请求,而对于 PHP5.4,如果每秒的请求数超过了190次,服务器的响应时间就会急剧增加。




What Does the Future Hold for PHP 7 and HHVM?

PHP 7 is due for stable release in November 2015. Therefore, companies are not yet using the new language, but promising benchmark test results of the performance of the beta version of PHP 7 could tempt more companies to adopt the new version of the language.

The future looks bright for PHP 7, but what about HHVM? It is likely that it is far from dead. Many businesses are already using HHVM to increase performance on their sites. The transition between PHP and HHVM is not instantaneous. It took Etsy more than six months to complete the transition. With the speed benefits of PHP 7 compared to HHVM being only very slight, it is unlikely that businesses will rush to switch back to PHP.

Facebook is continuing to develop HHVM. It has recently announced support for Mac OS X, making the technology accessible for developers who prefer to work in the Apple development environment. HHVM developers are convinced thatHHVM is still faster than PHP 7 in many situations, including with WordPress.

译者信息

译者信息

strwei
strwei
翻译于 2年前

1 此译文

其它翻译版本:1(点击译者名切换)
听取新翻杨柳枝

未来PHP7和HHVM何去何从?

PHP7 稳定版将发布于 2015年11月。因此,公司尚未使用新的语言,但 PHP7 测试版的性能有希望的基准测试结果可以吸引更多的公司使用新版本。

未来是 PHP7 的时代,那 HHVM 呢?很遗憾,它是离死不远了。虽然现在许多企业已经在使用 HHVM增加在其网站上的表现。  但是 PHP 和 HHVM 之间的过渡不是瞬间就能完成的。Etsy(一个网络商店平台)花了的半年多时间来完成过渡。在和 PHP7 相比,HHVM 暂时只有很轻微的速度好处,企业会急着切换回 PHP。

Facebook 正在继续开发 HHVM。它最近宣布了对 Mac OS X 的支持,使该技术让苹果开发者便于使用。 HHVM 开发商相信他们的 HHVM 仍比 PHP7 快,在很多情况下,包括与 WordPress。

Why Does the HHVM vs. PHP 7 Competition Matter to PHP Shop Owners?

As an online store owner, you need to make your decision on whether to use PHP 7 or HHVM based on the platform that hosts your shop. For example, if your site is built using WordPress, take a look at benchmark tests for HHVM and PHP 7 to find out how the latest release of each one performs. You want to choose the solution that can offer the biggest reduction in page load times, server response times and CPU usage.

Reasons to Choose HHVM

  • HHVM uses dynamic translation to deliver faster performance in many situations, including on WordPress.

  • HHVM uses less memory to process each request in cases where it faces a very large number of requests.

  • HHVM developers are steadily increasing the number of PHP code bases that the engine can run. It can already run the latest version of WordPress, along with many other common PHP frameworks and applications.

  • HHVM is open source. Even though HHVM has been developed by Facebook, it is open source, which means the source code is available to anyone who wants to use or alter it.

译者信息

译者信息

听取新翻杨柳枝
听取新翻杨柳枝
翻译于 2年前

1 此译文

为什么 HHVM 和 PHP 7 对于网店老板存在竞争关系?

作为一个网店老板,你需要根据你的网店所在的平台决定是否使用 PHP7 或 HHVM。如果你的网站是用 WorldPress 创建的,那么你可以看看最新版本的 HHVM 和 PHP 7 的基准测试结果,从测试结果可以发现两者在性能上的差异,然后你就可以选择解决方案,最大限度地减小页面加载时间,服务器响应时间和 CPU 使用率。

选择 HHVM 的原因

  • HHVM 使用动态翻译技术,在大多数情况下(包括WordPress)可以提供更高的性能。

  • HHVM 在处理大量请求时,可以保证每个请求只使用少量的内存。

  • HHVM 开发者正在稳步增加这个引擎所能运行的 PHP 代码的数量,它已经可以运行最新版本的 WorldPress,以及其他常见的 PHP 框架和应用。

  • HHVM 是开源的,尽管 HHVM 是 Facebook 开发的,但它是开源的,意味着任何人都可以使用和修改它的源码。


Reasons to Choose PHP 7

  • PHP 7 performs faster than HHVM in some situations, including when running on Drupal 8.

  • Using PHP 7 doesn’t require you to install or setup HHVM.

  • Code written in PHP 5 should work as expected after a transition to PHP 7, although some features of PHP 4 code are no longer supported in the new release. In practice, this means that any code created in the last decade is probably ready for the transition to PHP 7.

  • PHP 7 is developed by the PHP community, a group with a long-standing reputation for creating stable and reliable PHP releases.

HHVM vs. PHP 7: Make Your Choice

Don’t agonize for too long over the decision. Kinsta recommends that online businesses choose quickly between PHP 7 and HHVM. The sooner you make your decision, the sooner you can begin to implement the solution, allowing you to optimize your website performance. A poorly performing website can cause your reputation to suffer, which can be difficult to reverse.

Both HHVM and PHP 7 offer significant benefits compared to older versions of PHP. Make your choice and start the process of switching your site to the new system as soon as possible.

译者信息

译者信息

ChappaKo
ChappaKo
翻译于 2年前

1 此译文

选择 PHP 7 的理由


  • PHP 7 在某些情况下比 HHVM 更快,包括运行 Drupal 8。 


  •  使用 PHP 7 不需要安装设置 HHVM。 


  • 尽管很多 PHP 4 的功能在新版本中不再支持,但用 PHP 5 写的代码在转换到 PHP 7 后将会如预期一样工作。

  • PHP 7 由 PHP 社区开发,这是一群开发稳定可靠 PHP 版本久负盛名的人。 


HHVM vs. PHP 7: 作出你的选择

不要犹豫太久,Kinsta 建议那些在线的网站尽量在 PHP 7 与 HHVM 之间作出选择,早点开始实施解决方案,让你的网站性能得到优化。一个低效的网站也会让你的声誉受损,那将很难挽回。
相对于旧版本的 PHP,HHVM and PHP 7 都更有益。作出决定,尽快将你的网站切换到新的系统。


顶部