Re: [SMARTY-DEV] Inlining plugins/modifiers
| From: | boots | Date: | Thu, 22 May 2003 19:36:48 +0000 |
| Subject: | Re: [SMARTY-DEV] Inlining plugins/modifiers | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1495@lists.php.net to get a copy of this message | ||
-- Andrei wrote ----
> Inline will increase the size of the code and will actually reduce
the
> performance. The only overhead currently is a hash lookup in
> include_once() to see whether the file has already been included.
I think there is another point that is being missed that makes inlining
attractive. Yes, include_once helps as does an accelerator. Andrei's
comment is misleading, though: why should performance decrease? Because
inlining will cause certain portions of the page to be re-compiled by
PHP while they would otherwise just be looked up?
Consider the case where you have a compiled template that does not need
to do ANY further plugin loads, etc. The filesystem is one of the
slowest subsystems in the computer so minimizing ANY indirect calls to
it is a Very Good Thing, especially if the calls were consolidated into
a single pass at compile time. When a client includes this compiled
file the only "lookups" are for the file itself, which, though longer,
if sitting in an accelerator's cache, will be delivered very quickly.
No hash lookups at all. It is disingenious to say it is slower to
inline "period": it doesn't take even a million hits to see that there
is a POTENTIAL savings here.
On the other hand, its tricky business because there are many details
to consider, especially in a caching system. Also, it makes plugins
more like snippet libraries. Never-the-less, I think inlining merits
consideration though I don't think it should be an on-or-off switch.
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com