Re: [APC-DEV] APC and autoloading
[email protected] (David Zülke) Mon, 25 Sep 2006 10:42:51 +0200
| Newsgroups | php.apc.dev |
|---|---|
| Message-ID | <[email protected]> |
Yeah, I got that. But is it really _that_ much slower - or, rather,
really slower than a _once on < 5.2? My first impression was that
there is no acceleration at all, but that doesn't seem to be the case.
Thanks,
David
Am 25.09.2006 um 10:22 schrieb Rasmus Lerdorf:
> David Zülke wrote:
>> Hi folks,
>> I hope this is the right place for my question ;)
>> Over at the Propel (http://propel.phpdb.org) Dev Mailing List,
>> we're discussing moving to autoloading completely. Someone then
>> mentioned the following ticket: http://pecl.php.net/bugs/bug.php?
>> id=8765
>> Is it indeed accurate that APC doesn't accelerate _anything_ if a
>> class is loaded via autoloading? I know it doesn't work well with
>> _onces, but PHP 5.2 fixes that from what I understand.
>> I always thought autoloading was the way to go, since it's not
>> doing a _once (for obvious reasons), and it's only loading stuff
>> on demand, so I assumed it to be the fastest of all possible
>> solutions.
>> I'd greatly appreciate any insight on this "issue".
>
> Gopal summed it up nicely. It boils down to the fact that anything
> you push down into the executor is going to be slower than the same
> thing done in the compile phase. This is not an APC-specific
> thing, but a generic characteristic of any cache that caches the
> output of the compile phase. Any sort of runtime definition of
> classes or functions is going to be slower than compile-time. It's
> not hard to figure out what will be slow and what won't be. Just
> think about whether something can be completely defined without
> actually executing your script.
>
> eg.
>
> <?php
> class foo() { }
> ?>
>
> can be defined at compile-time.
>
> <?php
> if(cond) (
> class foo() { }{
> }
> ?>
>
> can't be, since we have to execute the script to evaluate the
> condition before we know whether we should create the class.
>
> -Rasmus
>
> --
> APC Development Mailing List (http://pecl.php.net/APC)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>