Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Web Architecture : Education - Tutorials
Writing efficient PHP
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
3. Tweaking PHP code
  


Keeping source include files small page 6 of 11


Since, PHP files are parsed and compiled at runtime, you should try to keep your source file sizes as small as possible. Source file size is particularly important with files that are included by other files. Only include or require files you absolutely must have. Additionally, if you only need one function in a file, consider breaking that function into its own file.

One thing of interest here is that after running tests on a variety of source files with varying amounts of comments, I found that the amount of comments in a source file had no significant impact on performance. The only thing that seemed to affect performance was the amount of PHP code in the files. This seems reasonable when you consider that comments basically are ignored by the compiler, while any code must be parsed and compiled -- something that is much more time consuming.


Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact