微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHP加速器与即时编译

来自维基百科:

Most PHP accelerators work by caching the compiled bytecode of PHP
scripts to avoid the overhead of parsing and compiling source code on
each request (some or all of which may never even be executed). To
further improve performance, the cached code is stored in shared
memory and directly executed from there, minimizing the amount of slow
disk reads and memory copying at runtime.

及时编译:

JIT compilers represent a hybrid approach, with translation occurring
continuously, as with interpreters, but with caching of translated
code to minimize performance degradation.

所以在PHP上使用PHP加速器如APC对“即时”编译PHP性能有相同的影响(假设它可以这样做)….实际上它们实际上是同一个东西吗?

解决方法:

so is using PHP accelerators such as APC on PHP have equivalent implications towards performance with “Just-in-time” compiling PHP (assuming that it’s possible to do so)….in fact are they actually the same thing?

相同的概念,不同的执行.

在大多数圈子中提到JIT时,它指的是将虚拟机字节码编译为本机字节码.例如,Facebook的HHVM一个使用JIT enginePHP实现.

但是,PHP的本机虚拟机不会对本机字节码执行JIT.事实上,它根本不是传统意义上的JIT.虽然整个文件按需编译为PHP字节码,但实际上并不是JIT.

注意术语“PHP加速器”.回到PHP4时代,PHP解析器创建的字节码可以稍微优化一下,以获得更好的性能.自PHP5早期以来就不需要这样做了. APC,Zend“Optimizer”和其他“加速器”产品唯一能提高PHP性能的是缓存字节码.不应再使用术语“加速器”来消除歧义.

如果您使用的是标准PHP,那么您确实需要一个字节码缓存,只需避开那些说他们尝试进行PHP字节码优化的产品.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐