phpperformancefile

How slow is is_readable()?


Is it ok if I use it to check if some file exist, like 10-15 css/js/php files? This would be done on each page load.

How much would it slow it down?


Solution

  • Assuming that it is a local file (and not an NFS mount), it won't slow anything down, and it may be even faster than issuing a request to a file that is not readable. Also, is_readable caches the results. You have to call clearstatcache if you want to dismiss the cached results. Sure, the best way to check is to profile your page after adding the is_readable call, but I bet it won't make any difference