Reputation: 23
I have a PHP file that is 90 KB. It pretty much does all the work for the back end on my site and it gets loaded on every page. However, if I split up the different functions in this file and separated them across multiple files, I could reduce the total size of what is loaded on average on each different page to 45 KB.
Is loading a 90 KB PHP file with "everything on it" for each page going to slow the performance of my site down? Does it make more sense to split up the 90 KB file into smaller files and only load what is necessary for each page? Or is 90 KB small enough that it shouldn't matter.
Upvotes: 0
Views: 74
Reputation: 23
Turn on Opcache and PHP will store the pre-processed source in memory and then it doesn't matter.
When a file is accessed your OS will usually cache that file in RAM until the memory needs to be reclaimed, and then it doesn't matter.
What is in which file is far better classified as an organization problem for a project and its maintainers, and this incredibly marginal performance consideration [say it with me] doesn't matter.
Thank you Sammitch from the comments
Upvotes: 1