A while ago I thought about creating PHP *optimizer*. The goal is to make PHPTAL-generated code as efficient as hand-written code, e.g. merge adjacent strings and echo statements (implemented) and avoid pushState() calls or maintenance of repeat/xx/key variables when those features are not used (not implemented yet).

To achieve this I've refactored PHPTAL's code generator to create sort-of Abstract Syntax Tree/intermediate representation mix. Generated code uses classes such as PHPTAL_Expr_Echo and PHPTAL_Expr_If, and these can be inspected, modified, optimized, etc.

I've released work-in-progress code:


Is anybody in the mood for writing an optimizing PHP compiler? :)

regards, Kornel

PHPTAL mailing list

Reply via email to