[wp-hackers] This is a Performance Enhancement? Clarification

Otto otto at ottodestruct.com
Thu Jan 7 22:45:27 UTC 2010


On Thu, Jan 7, 2010 at 3:08 PM, Jacob Santos <wordpress at santosj.name> wrote:
> Myth 2. Conditional loading speeds up PHP.
>
> The problem I have with the comment [3] is that it uses the myth that
> conditional functions and file loading speeds up execution of PHP, when you
> can not find a single source that will ever say this. In fact, all of them
> will say that it slows down execution, because PHP has to stop the
> execution, go back to the compile stage and then go back to the execution.

Well, file loading on-the-fly has to do that anyway, right?

I mean, not doing an include is always faster than doing the include
*if* the cost of the include is higher than the cost of the comparison
you're making to determine whether or not to do the include. Of
course, if doing the include turns out to be the most common case,
then your conditional might not be worth the trouble.

And anyway, I thought most modern PHP executables did JIT compiling nowadays.

Best is to design your code so that the include happens when it's
known to be needed, but not earlier.

I agree with you with regards to functions, and to how this sort of
thing in general may hurt opcode cache systems.

-Otto


More information about the wp-hackers mailing list