There will be a difference, between a 200KB and a 20KB file... But you will probably not notice it : a 200KB file is not that big -- and you generally use a lot of files that are not "small", when you're building a big application.
There are two things that take time, when you're loading a .php
file :
- The PHP source code is "compiled" to "opcodes" -- that's quite equivalent to JAVA bytecode
- This is done each time a PHP file is included, by default
- But, using some opcode cache like APC, those opcodes can be kept in memory, and this compilation stuff not done each time anymore -- which is great : it'll mean less CPU used, as the compilation will not be done anymore (it'll be done only once in a while).
- The opcodes are executed
- Depending on what you script contains, this can take some time, or not :
- If the file only contain functions or classes definitions, this will not take much time : nothing will get executed.
- If the file contains instructions, it'll take more time ^^
As a sidnote : in a general situation, you'll gain a lot more time/cpu/resources optimizing your SQL queries, or adding some caching mecanism, than thinking about that kind of stuff.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…