On Thu, October 5, 2006 6:18 pm, John Wells wrote:
> On 10/5/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> include_path is a much more powerful and flexible construct which
>> will
>> save you an inordinate amount of trouble if you just figure out how
>> it
>> works and use it...
>
> Point well taken Richard, thanks.
>
> I've always been curious, iIs there a point in which adding some
> number of paths to include_path causes a performance hit?  If my
> application for example is spread out across 6 or 7 folders
> (controllers, models, library, plugins, scripts, etc etc), is it
> really better to shove all of those into include_path?

There is, of course, a performance hit, in that PHP searches for your
include file in each of those paths before it finds "the one"

Depending on server configuration, caching, and hardware, that could
be immesurably small for 6 or 7 paths, or it could be a Big Deal.

Only you can test on your hardware with your setup.

But I would dare to predict that for most users, the performance
difference is negligible because you are almost for sure not including
enough files to be causing enough operations for it to matter.

Sure, you can construct a benchmark to "prove" that there is a
performance difference.  But can you construct a real-world test with
peak load usage similar to real users that shows a meaningful
difference?  Cuz you don't really care about a benchmark about a
billion includes when your web app never does a billion includes...

If you have a directory that has "most" of the includes in it, put it
first, of course -- Surely that would be easy enough to do, and would
address any performance issue "well enough" for a real world setup.

Another option is to MAYBE consider combining some of those dirs, and
using a filename convention to make it clear which ones are model and
which are controller and which are library.

And, of course, if you are using a cache, then the search through
include_path is only done once per cache-fault.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

Reply via email to