Roman Borschel wrote:
> A small addition:
> 
> the exact same test results in the following average times on my dev
> machine:
> with bundled classes: ~0.07s (~2-10 includes)
> without:  ~0.10s (~60-80 includes)
> 
> Thats ~30ms difference in average. I wanted to post that because the
> results on my dev machine are much more constant than the one on the
> vserver. And the xdebug profiling result shows me in fact that this
> additional time seems to be spend in the autoload facility and its
> require_once calls. These are the calls that are skipped when the big
> class bundle is loaded in advance.

Hi Roman,

APC's fastest performance with separate files occurs with an
unconditional include statement with a full path.  autoload always
occurs at runtime, which incurs higher overhead than an unconditional
include.  Removing the include statements entirely by combining all code
into a single file results in even better performance.  All code in 1
file is always faster than unconditionally including the code you use
which is always faster than using autoload to include the same code at
runtime, this is what the benchmark I ran showed conclusively.

However, if you have a complex app with many lines of code to include
and many classes, most of which are not used in a single request, you
might be able to get *better* performance from autoload than from an
unconditional include, simply because many fewer lines of code are
actually parsed, compensating for the slower performance of autoload.

On the other hand, combining multiple files into a single file results
in line numbers no longer corresponding to the original line numbers of
the file, adding another translation step when debugging a problem.  Of
course, this is just simple arithmetic, but not all developers will
benefit from this approach, just as not all developers benefit from
using autoload.

Each app has a different need, my only goal with the multiple namespace
per-file patch is to make it possible to optimize by combining files
into a single file, as the existing PHP program space shows there are
already apps that can benefit from this approach.

Greg

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to