PHP OPcache optimization levels - what are they?

让人想犯罪 __ 提交于 2019-11-29 22:59:36

The bits of opcache.optimization_level correspond to:

  • bit 0 - pass 1:
  • bit 1 - pass 2:
    • Convert constant operands to expected types
    • Convert conditional JMP with constant operands
    • Optimize static BRK and CONT
  • bit 2 - pass 3:
    • Convert $a = $a + expr into $a += expr
    • Convert $a++ into ++$a
    • Optimize series of JMPs
  • bit 3 - pass 4:
    • PRINT and ECHO optimization - removed
  • bit 4 - pass 5:
    • block optimization (the most expensive optimization pass which perform many different optimization patterns based on CFG - control flow graph)
  • bit 8 - pass 9:
    • register allocation (allows re-usage of temporary variables)
  • bit 9 - pass 10:
    • remove NOPs

I've looked around to see if I can find anything on any code patterns that it handles better than others, but I haven't had any luck.

Information from https://github.com/zendtech/ZendOptimizerPlus/blob/master/Optimizer/zend_optimizer.c and https://gist.github.com/ck-on/4959032?ocp.php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!