Flourish PHP Unframework

Performance Tips

This page is a small collection of some tips to help increase performance of you PHP code. Most of them require that you have enough control of the server to be able to change settings in Apache and load different PHP extensions.

Opcode Caching

Under normal operation, PHP will load each source code file upon each request. The source code files are first compiled into PHP opcodes and then the opcodes are executed. A number of PHP opcode caching extensions exist that keep the compiled opcodes stored in memory and only regenerate the opcode if the source code changes.

Mike Willbanks has a comparison of APC, eAccelerator and XCache from late 2007.

fLoader will utilize the most performant loading technique based on the current execution environment. If a opcode cache is present, all classes will be included. If not, autoloading will be done via spl_autoload_register().

Extensions

A few of the Flourish classes provide pure PHP implementations of functionality that is also available from extensions that are not installed by default. Below is a list of the classes and the extension that will provide better performance.

Class Extension
fJSON json (included in 5.2 by default)
fNumber/fMoney bcmath
fUTF8 mbstring