Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 1.76 KB

PerformanceTips.wiki

File metadata and controls

39 lines (30 loc) · 1.76 KB

Performance Tips

<<toc></toc>>

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.

 - <a href="http://pecl.php.net/package/APC" target="_blank">APC</a>
 - <a href="http://eaccelerator.net" target="_blank">eAccelerator</a>
 - <a href="http://turck-mmcache.sourceforge.net/index_old.html" target="_blank">Turck MMCache</a>
 - <a href="http://xcache.lighttpd.net" target="_blank">XCache</a>

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 ||