CPU usage with file_exists in php

I own a site with a high httpd processor per minute. I noticed that I use "file_exists" for every httpd request. Is this feature very heavy?

+3
source share
3 answers

This function will only check for the presence of a file - which means access to the disk (which may take a little time, but not so much)

Given that your application is probably made up of dozens (if not hundreds) of PHP files that you need to read for each request, I don’t think that one file_existsmatters.

(Well, at least while you check the file on the local drive - do not miss a single network drive or something like that)


: , PHP-, Xdebug, .

, , : , php? - t .

( , Xdebug ):

+6

, " ", , - , , Zend Studio.

+2

file_exists is usually very cheap, especially since the result is cached in php stat cache . Areas such as heavy databases are typically the largest processor consumer.

try profiling to determine which part of your application uses the most time, some examples here:

http://www.ibm.com/developerworks/opensource/library/os-php-fastapps2/

+1
source

Source: https://habr.com/ru/post/1727983/


All Articles