johnsmith153 Posted February 21, 2013 Share Posted February 21, 2013 Roughly how long would it take PHP to perform 4 x is_file() actions? I have the exact path to the files and all four checks are in the same folder. All files are very small in file size. I'm sure many people will say, "it depends", but I'm looking for a rough guide. Are we taking 10ms, 100ms, 250ms, a second, 10 minutes - just roughly? This will help me decide if to re-write my script so as not to perform the checks and use a different method. Currently this is done on every page request. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/274792-how-much-processing-does-php-take-to-perform-4-x-is_file-actions/ Share on other sites More sharing options...
Jessica Posted February 21, 2013 Share Posted February 21, 2013 The only way you can get an accurate estimate is to run the script. Quote Link to comment https://forums.phpfreaks.com/topic/274792-how-much-processing-does-php-take-to-perform-4-x-is_file-actions/#findComment-1413989 Share on other sites More sharing options...
kicken Posted February 21, 2013 Share Posted February 21, 2013 "It depends" is about as good as you'd get really. The function could execute very quickly or it could be a bit slow. Since it involves the file system, the biggest influence on how only it takes to run will be the current disk I/O load and whether or not the stats for that file are already available in memory or need to be read from disk. If everything is already in memory and no disk I/O has to be preformed to get the information, the function would likely run in 1ms or less. However if it has to hit the disk it'd take probably at minimum whatever the disk's seek/access time is. Probably around 8-10ms or so. That's assuming the request can be serviced immediately. If there is currently a lot of load on the disk (lots of things all trying to read or write data) then the request may be delayed. How long it's delayed will depend on the load. Quote Link to comment https://forums.phpfreaks.com/topic/274792-how-much-processing-does-php-take-to-perform-4-x-is_file-actions/#findComment-1414018 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.