The open source SmartTpl libraries greatly speeds up Smarty templates bij turning templates into native machine code. During a crash course 'how to write your own compiler' you will see how this alternative template engine works inside, and you will discover that writing a compiler is not even that difficult.