PHP速度与其他语言 [英] PHP Speed Vs Other Languages

查看:80
本文介绍了PHP速度与其他语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过很多PHP比其他语言慢.速度差异是否足够明显,可以切换到另一种语言?如果是的话,您会推荐什么其他语言?还是可以通过一些好的优化来加快PHP的速度?

I have heard a lot that PHP is slow compared other languages. Is the speed difference noticeable enough that I should switch to another language? And if so what other language would you recommend? Or what would be some good optimizations that could speed up the PHP?

推荐答案

这个问题很多.答案是:

This question comes up a lot. The answer is:

  • 是的,它比C#,Java,C/C ++等慢.
  • 不,没关系.

您可以构建大规模的PHP系统.访问的前20个网站中有4个由PHP提供支持(Facebook,Yahoo,Wikipedia,Flickr).带有操作码缓存的PHP(例如 APC )可以使您的工作更进一步可能会需要或在意.

You can build large scale PHP systems. 4 of the top 20 visited Websites are powered by PHP (Facebook, Yahoo, Wikipedia, Flickr). PHP with an opcode cache (eg APC) can take you much further than you'll probably need or care about.

大多数速度慢的网站与他们使用的语言无关. HTTP请求上花费的大量时间归因于网络延迟,静态资源的缺乏或无效缓存,缺少压缩导致使用的带宽超出了必要,以及Java脚本性能不佳等.

Most slow Websites have nothing to do with the language they're using. A lot of the time spent on an HTTP request comes down to network latency, absent or ineffectual caching of static resources, lack of compression resulting in more bandwidth used than necessary, poorly performning Javascript and so on.

如果您对性能表现感到绝望,可以随时使用 HipHop ,它将PHP编译为C ++.

If you get really desperate for performance you can always use HipHop, which compiles PHP to C++.

这篇关于PHP速度与其他语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆