OpCode to see the problem of PHP code performance
Recently seen in the "? some php Coding Tips mention one thing: avoid doing arithmetic in the for-judging condition.
?
So the rise with VLD looked at:
for ($i =0; $i<>< p=""><>
For ($i =0, $j =strlen ($STR), $i < $j, $i + +)
OpCode
$name = "Xiaoshenge"; for ($i = 0; $i < strlen ($name); $i + +) { echo "1";}
?
$name = "Xiaoshenge"; for ($i = 0, $j = strlen ($name); $i < $j; $i + +) { echo "1";}
?
From this point of view opcode difference really don't see, so I have a little doubt to see the article with opcode look at the performance of PHP code, so sent an email leave a few seniors, but only one to see and reply to me.
?
?
Which reeze.xia@gmail.com (http://www.phppan.com/) is how to reply:
?
The similarities and opcode of the two are understandable, opcode is equivalent to just translating the operations needed,
But we can intuitively see the two from the code, the latter need to do the calculation will be small, but this is only viewed from the straight,
In the end, we still need to do a performance test to verify, because the performance involved in the content is too wide,
The Zend engine itself may be optimized for operations, and the CPU itself will have its own optimizations, which can all affect our performance:)
Therefore, PHP opcode is not similar to C-compiled executable file, simply use opcode to share code execution efficiency is still a bit of a problem ...
?
?