FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How expensive is glob'ing a dir and including all the files?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
How expensive is glob'ing a dir and including all the files? [message #179140] Fri, 14 September 2012 19:35 Go to previous message
J. Frank Parnell is currently offline  J. Frank Parnell
Messages: 12
Registered: January 2012
Karma:
Junior Member
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:
<?php
if ((file_exists($funccache)) AND (@$_GET['recache']!=true)){
include $funccache;//just an array of the files names, see below.
}else{
$incs = glob($funcspath."*.php") ;
$ra = var_export($incs,true);
$put = @file_put_contents($funccache,"<?php \$incs = $ra; ?>");
}
foreach ($incs as $i) {
require $i;
}
?>

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?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: php and PDO Error HTTP 500
Next Topic: PHP Update
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 10:01:18 GMT 2024

Total time taken to generate the page: 0.05042 seconds