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 menuFeedbackNext
2. Writing efficient code
  


Coding for efficiency page 1 of 15


In this section, I review a variety of things that contribute to writing efficient code, whether in PHP or another language. Note that some of the following suggestions may, in the minds of some people, reduce the readability of the code. However, the payoff is in terms of improved performance.

You, as the developer, determine the points in an application where performance or readability and maintainability are the primary concerns. For example, if a piece of code is executed once per instance of an application, then readability is probably most important. However, for a piece of code that may be executed thousands, even millions of times per application instance, then performance is probably of greater importance than readability. Even this depends on a number of external factors -- such as the time available to execute that piece of the application, the amount of work to be done during each iteration, and the users' perceived performance of that part of the application.

If you do apply any of these techniques for improved performance, and you think it negatively impacts the readability of the code, add extra comments to the code and explain what is happening.


Main menuSection menuFeedbackNext
Privacy Legal Contact