Yes and no. Rasmus Lerdorf has explained (http://pooteeweet.org/blog/538)
that opcode caching is a compile-time optimization. Runtime inclusion of
code happens after compile-time is past, and therefore cannot use the opcode
cache.
This is not correct. Each file is compiled by the engine separately, so
include can and are benefiting from opcode caching.
Now, there are certain uses of certain things like inheritance that make
certain opcode caches not cache these files. For APC story read here:
http://t3.dotgnu.info/blog/php/demystifying-autofilter.html
though it definitely does not apply to other solutions, e.g. Zend
Platform.
However, any runtime "require_once" is resolved too late to benefit from the
opcode cache. For example, loading classes in a function, loading classes
depending on a PHP variable, and use of autoload. The code has to be
fetched from the filesystem at runtime and compiled on the fly. It's as if
you aren't using an opcode cache solution.
Autoload does benefit from opcode caching, as would most instances of
loading classes from functions, etc. However, some things - like
conditional definition of classes depending on variables etc. may not
work correctly with opcode caches, and lead some of them - e.g. APC - to
avoid caching those files.
BTW, we plan to solve these problems in 5.3 - so that all opcode caches
(that would bother to use the new stuff of course ;) will be able to
cache all files in 5.3+, regardless of how and when and in which way
they were included.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED] http://www.zend.com/
(408)253-8829 MSN: [EMAIL PROTECTED]