[phpa] Re: Dynamic includes?
- From: "Nick Lindridge" <nick@xxxxxxxxxxxxxxxxxxxxx>
- To: phpa@xxxxxxxxxxxxx
- Date: Tue, 26 Mar 2002 22:23:53 -0000 (GMT)
>
>> > I'm wondering how PHP Accelerator handles includes that are run-time
>> > selected?
>>
>>Runtime includes should be no problem. PHPA just reacts to what the
>>internal
>>compiler is normally asked to do. In fact it becomes the PHP compiler,
>>intercepting all requests for scripts. If it can it will return the
>>compiled
>>code from the cache, bypassing the read/parse/compile step. If not then
>>it delegates the request to the standard compiler for processing in the
>>usual way.
>>
>>So code remains entirely as dynamic, or not, as it is without PHPA
>>installed.
>
> Hmm OK I'll refine my question.. how "acceleratable" is this kind of
> code? Or do runtime-selected includes basically defeat the
> compiled-code cache mechanism? Ie. how does the accelerator determine
> whether code needs to be recompiled or not? (Are there any
> rules-of-thumb for producing acceleration friendly code?)
It will accelerate just as well as statically defined includes. The
performance difference should be negligible, and in fact, immeasurable.
Although I've considered this as an interesting, but difficult and probably
ineffective optimisation, PHPA has no knowledge ahead of time about what
will be included. Essentially, every include is dynamic.
> I'm guessing performance might be an issue and I'm willing to look at
> alternative implementations. Any thoughts are appreciated.
The beauty of a tool like phpa is that you really don't have to pull tricks
to speed up your code by attempting to include the minimal set of code. Just
craft your code with the most logical, ideal, and maintainable structure.
So 'run time' includes don't defeat the cache in any way, but they might
defeat other desirable design principles, and incur extra debugging effort
when you're trying to determine why the files you want aren't being
included, or you're getting the wrong includes. If you need dynamic
includes by design, then of course that's fine.
nick
------------------------------------------------------------------------
www.php-accelerator.co.uk Home of the free PHP Accelerator
To post, send email to phpa@xxxxxxxxxxxxx
To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe
- Follow-Ups:
- [phpa] Re: Dynamic includes?
- From: Eliot Shepard
- References:
- [phpa] Re: Dynamic includes?
- From: Robert M.
Other related posts:
- » [phpa] Dynamic includes?
- » [phpa] Re: Dynamic includes?
- » [phpa] Re: Dynamic includes?
- » [phpa] Re: Dynamic includes?
- » [phpa] Re: Dynamic includes?
- [phpa] Re: Dynamic includes?
- From: Eliot Shepard
- [phpa] Re: Dynamic includes?
- From: Robert M.