Sunday, September 16, 2012

Twig Template Engine

I've been working on a pretty major rebuild for Easy Event Planning over the last few weeks.  It was originally developed by a team of outsourced programmers in a certain country and the sites a bit of a mess.  Instead of fixing what's wrong, I'm rebuilding from the ground up.

That means that I had to tear apart the database structure, and make it optimized.  There were tables with 115 columns of data and 9 million records that were being queried by multiple "if exists" -- 12 second response times when the server didn't crash :)

As part of the rebuild I looked into ways to speed things up across the board. Caching both queries, and php executions helped, but there is another way to speed things up even more.  It's called twig and it's a template engine.

Unlike most template engines Twig compiles and caches and does all it's magic on the back end.  If it was complex just that might be enough.  However, it's simple to use and anyone who's programmed a little python will love it.

http://twig.sensiolabs.org/

Enjoy!

Ed Charkow:  http:www.edcharkow.com

No comments: