only for RuBoard - do not distribute or recompile Previous Section Next Section

Optimizing Code

If you come from a non-Web programming background, optimization can seem really important. When using PHP, most of the time that a user waits for a Web application comes from connection and download times. Optimization of your code will have little effect on these times.

Using Simple Optimizations

There are, however, a few simple optimizations that you can do that will make a difference. Many of these relate to applications that integrate a database such as MySQL with your PHP code, and some are listed as follows:

Using Zend Products

Zend Technologies own the (Open Source) PHP scripting engine for PHP 4 onward. This is a good deal faster (quoted as being two to ten times) than the version 3 engine, so if you haven't upgraded yet, do yourself a favor and install version 4.

In addition to the basic engine, you can also download the Zend Optimizer. This is a multi-pass optimizer that will optimize your code for you, and can increase the speed at which your scripts run from 40% to 100%. You will need PHP 4.0.2 or upward to run the optimizer. Although closed source, it is free for download from Zend's site:

http://www.zend.com

This add-on works by optimizing the code produced by the runtime compilation of your script. Upcoming Zend products include the Zend Cache, which will compile your PHP scripts and cache them so they are only recompiled when they are rewritten. This should offer another improvement in performance.

only for RuBoard - do not distribute or recompile Previous Section Next Section