With this question, I aim to understand the inner workings of PHP a
little better.

Assume that you got a 50K library. The library is loaded with a bunch
of handy functions that you use here and there. Also assume that these
functions are needed/used by say 10% of the pages of your site. But
your home page definitely needs it.

Now, the question is... should you use a global include that points to
this library - across the board - so that ALL the pages ( including
the 90% that do not need the library ) will get it, or should you
selectively add that include reference only on the pages you need?

Before answering this question, let me point "why" I ask this question...

When you include that reference, PHP may be caching it. So the
performance hit I worry may be one time deal, as opposed to every
time. Once that one time out of the way, subsequent loads may not be
as bad as one might think. That's all because of the smart caching
mechanisms that PHP deploys - which I do not have a deep knowledge of,
hence the question...

Since the front page needs that library anyway, the argument could be
why not keep that library warm and fresh in the memory and get it
served across the board?

When answering this question, please approach the matter strictly from
a caching/performance point of view, not from a convenience point of
view just to avoid that the discussion shifts to a programming style
and the do's and don'ts.

Thank you


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to