Re: How expensive is glob'ing a dir and including all the files? [message #179162 is a reply to message #179146] |
Sun, 16 September 2012 17:50 |
J. Frank Parnell
Messages: 12 Registered: January 2012
Karma:
|
Junior Member |
|
|
Ok, so I tested via:
function microtime_float(){
list($utime, $time) = explode(" ", microtime());
return ((float)$utime + (float)$time);
}
$script_start = microtime_float();
require '_funcs/_funcs.php';//this file does the globing, cacheing, including
$script_end = microtime_float();
echo "Script executed in ".bcsub($script_end, $script_start, 4)." seconds." ;
and I got
Script executed in 0.0200 seconds
Thats with either globing or reading the cache file (which backs up the statement that the glob doesnt add much)
Afa size and traffic of sites, wordpress sites, plenty of plugins and custom stuff. Traffic, some might be 100-500 page views/day.
Testing script execution for the whole page gave me around 2.5 seconds.
The whole front page takes around 2 seconds
On Friday, September 14, 2012 6:45:35 PM UTC-7, Jerry Stuckle wrote:
> On 9/14/2012 7:43 PM, Michael Fesser wrote:
>> .oO(Jerry Stuckle)
>>> On 9/14/2012 6:24 PM, J. Frank Parnell wrote:
>>>> 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.
> Not that much difference. The majority of the time is in the parsing,
> not reading the files, especially since the files will most probably
> already be in buffers.
>
|
|
|