It is very common to use include files. I think it is overused to keep the codes tidy without considering performance. For several includes, disk should read the files, and as we extremely use disk, it can be a slow process. However, this is not the main slow process or the rate-limiting process, as loading the file with file_get_contents is few times faster.
I think this is the reason that major websites put javascripts within the html file rather than loading them by file. Alternatively, it can be a good idea to split a large JS file into several small JS files, as parallel http requests can load the entire JS codes faster. But this is different from php files, as php script reads include files one by one during the process.
Please comment how much serious this problem can be? Imagine a webpage is loaded in 0.60s, can
includeof 10 php files turn it to 0.70s?Although this effect should be negligible, I want to know if there are approaches to speed up this process. I do not mean php caching like
APC.
P.S. This question is not for practical application (a typical case), but theoretical considerations in general.
includeshould be extremely fast, and even faster if you enable APC. Your chasing the wrong end of the stick here.