Re: How expensive is glob'ing a dir and including all the files? [message #179148 is a reply to message #179147] |
Sat, 15 September 2012 13:14 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 9/15/2012 2:08 AM, Anders Wegge Keller wrote:
> "J. Frank Parnell" <juglesh(at)gmail(dot)com> writes:
>
>> So, my question is, am I saving a significant amount of ram/cpu/time
>> by keeping this cache of filenames or should I just glob the dir and
>> include what's in there everytime?
>
> You may want to consider autoloading classes as needed. See
> http://php.net/manual/en/language.oop5.autoload.php
>
> This approach is of course dependent on using PHP5 *and* having an
> OO design.
>
Additionally, you're never sure which module you got. All kinds of
hard-to-diagnose things can happen when someone uploads a module of the
same name but earlier in the search path. You'll be trying to debug one
module while the system is using an entirely different module.
Plus the extra overhead of searching for the module, of course.
This is not a feature I recommend. It can cause many problems, and good
programming techniques render it pretty much unnecessary.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|