Re: How expensive is glob'ing a dir and including all the files? [message #179160 is a reply to message #179149] |
Sun, 16 September 2012 14:37 |
Peter H. Coffin
Messages: 245 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 15 Sep 2012 23:41:18 +0200, Anders Wegge Keller wrote:
> Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>
>> 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.
>
> Speaking from experience?
>
>> 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 let "someone" muck around with your code? Are you hosting at
> GoDaddy or something like that?
"Someone" could be another developer working on the same project of even
yourself comeing back to the code after ignoring it for a few years. An
awful lot of code looks completely foreign with three years on it, even
if one was completely familier with it back then.
--
31. All naive, busty tavern wenches in my realm will be replaced with
surly, world-weary waitresses who will provide no unexpected
reinforcement and/or romantic subplot for the hero or his sidekick.
--Peter Anspach's list of things to do as an Evil Overlord
|
|
|