Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7072

Re: How expensive is glob'ing a dir and including all the files?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: How expensive is glob'ing a dir and including all the files?
Date 2012-09-14 19:24 -0400
Organization A noiseless patient Spider
Message-ID <k30eco$3s1$1@dont-email.me> (permalink)
References <38015b6a-5ef2-4f92-9aa2-6eea01c7097a@googlegroups.com> <eli$1209141539@qz.little-neck.ny.us> <ec8ecf2a-45eb-406b-b0f8-29c4dda0a536@googlegroups.com>

Show all headers | View raw


On 9/14/2012 6:24 PM, J. Frank Parnell wrote:
> On Friday, September 14, 2012 12:41:35 PM UTC-7, Eli the Bearded wrote:
>> In comp.lang.php, J. Frank Parnell <> wrote:
>>
>>> I have my 'funcs' dir, full of about 120 files, totaling ~800KB.  A
>>> bunch of little utility functions.  Here is basically how i include
>>> them:
>>
>> ...
>>
>>> 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?
>>
>>
>> The glob for a directory with 120 files will be nothing compared to
>> the time it takes php to include() 800KB worth of stuff. You might
>> want to consider only including what you really need. That will be
>> the bigger win.
>> ---
>> glob on a very big directory (multiple thousands of files) is different
>
> When I do properties locally, on Win, it says size: 408KB, size on disc: 720KB.  Compared to the wordpress 'includes' dir at 5Megs, doesnt seem like much, although i'm not sure if wp includes that whole dir, always.  Would it be more efficient to concatenate my include files?
>

As others have said - include only what you need.  The time consuming 
part is parsing the PHP code, not reading one or more files. 
Concatenating will still require PHP to parse the code.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How expensive is glob'ing a dir and including all the files? "J. Frank Parnell" <juglesh@gmail.com> - 2012-09-14 12:35 -0700
  Re: How expensive is glob'ing a dir and including all the files? Eli the Bearded <*@eli.users.panix.com> - 2012-09-14 19:41 +0000
    Re: How expensive is glob'ing a dir and including all the files? "J. Frank Parnell" <juglesh@gmail.com> - 2012-09-14 15:24 -0700
      Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-14 19:24 -0400
        Re: How expensive is glob'ing a dir and including all the files? Michael Fesser <netizen@gmx.de> - 2012-09-15 01:43 +0200
          Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-14 21:45 -0400
            Re: How expensive is glob'ing a dir and including all the files? "J. Frank Parnell" <juglesh@gmail.com> - 2012-09-16 10:50 -0700
              Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-16 17:45 -0400
                Re: How expensive is glob'ing a dir and including all the files? "J. Frank Parnell" <juglesh@gmail.com> - 2012-09-16 16:00 -0700
                Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-16 20:17 -0400
  Re: How expensive is glob'ing a dir and including all the files? Salvatore <sal@yojimbo.hack.invalid> - 2012-09-14 19:44 +0000
  Re: How expensive is glob'ing a dir and including all the files? Anders Wegge Keller <wegge@wegge.dk> - 2012-09-15 08:08 +0200
    Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-15 09:14 -0400
      Re: How expensive is glob'ing a dir and including all the files? Anders Wegge Keller <wegge@wegge.dk> - 2012-09-15 23:41 +0200
        Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-15 18:06 -0400
          Re: How expensive is glob'ing a dir and including all the files? Anders Wegge Keller <wegge@wegge.dk> - 2012-09-16 00:10 +0200
            Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-15 18:21 -0400
              Re: How expensive is glob'ing a dir and including all the files? Anders Wegge Keller <wegge@wegge.dk> - 2012-09-16 00:39 +0200
                Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-15 18:45 -0400
                Re: How expensive is glob'ing a dir and including all the files? Anders Wegge Keller <wegge@wegge.dk> - 2012-09-16 00:59 +0200
                Re: How expensive is glob'ing a dir and including all the files? The Natural Philosopher <tnp@invalid.invalid> - 2012-09-16 00:09 +0100
                Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-15 19:19 -0400
                Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-15 19:27 -0400
            Re: How expensive is glob'ing a dir and including all the files? The Natural Philosopher <tnp@invalid.invalid> - 2012-09-15 23:38 +0100
        Re: How expensive is glob'ing a dir and including all the files? "Peter H. Coffin" <hellsop@ninehells.com> - 2012-09-16 09:37 -0500
          Re: How expensive is glob'ing a dir and including all the files? Anders Wegge Keller <wegge@wegge.dk> - 2012-09-16 17:32 +0200
            Re: How expensive is glob'ing a dir and including all the files? Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-16 17:46 -0400

csiph-web