Zend Optimizer Plus(O+)
- 2. What it is
• Not Only Opcodes Cache
• But Also Opcodes Optimizer
• Shiped with PHP since 5.5
• http://pecl.php.net/zendopcache
13年11⽉月11⽇日 星期⼀一
- 5. Optimizations
• Pass 1
•
Substitute persistent constants
•
•
Perform compile-time evaluation of constant binary and unary
operations
•
•
13年11⽉月11⽇日 星期⼀一
$a = 3 + 2 => $a = 5
Optimize series of ADD_STRING and/or ADD_CHAR
•
•
const A = 1; $a = A; => $a = 1;
$a = “a” . “b”; => $a = “ab”;
Convert IS_VAR to IS_CV when it is possible
- 6. Optimizations
• Pass 2
•
Convert non-numeric constants to numeric constants in numeric
operators
•
•
Optimize constant conditional JMPs
•
•
JMPZ(X, L1), JMP(L2) => JMPZNZ(X, L1, L2)
Optimize static BRKs and CONTs
•
13年11⽉月11⽇日 星期⼀一
$a = $b + “2”; => $a = $b + 2;
break to opcodes + offset => break to opcode
- 13. VS APC
• 7% - 10% faster than APC
• And More:
•
13年11⽉月11⽇日 星期⼀一