Jump to content

How much processing does PHP take to perform 4 x is_file() actions?


Recommended Posts

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

"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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.