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字节码优化的产品.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...