This is an old revision of the document!


Table of Contents

Performance

Opcode accelerator

The most important thing is to install PHP accelerator like APC. If you're concerned about speed, it's crazy not to use one.

opcode caches vs memcached

PHPTAL caches compiled templates on disk. Using memcached for template cache would be slower. Opcode accelerators like APC have their own in-memory cache and — most important — they store PHP code as compiled opcodes.

PHP has no way of storing compiled code in memcached, so the only way to use memcached is to eval() read templates, and that is the slowest way to run PHP code. Just letting APC to cache on-disk files is the fastest option.

Avoiding stat()

On every request PHPTAL also checks if source template has changed. You can implement your own SourceResolver and Source classes to avoid file timestamp checks or to load TAL template sources in a different way.

If you want PHP not to touch disk at all, disable apc.stat in php.ini.

Note: don't do this unless you absolutely need to. Disabling stat gives only tiny performance improvements, but without it PHP and PHPTAL won't notice when files are updated.