On Jun 5, 2007, at 2:54 PM, Perrin Harkins wrote:
I think that's a pretty questionable claim. TT is faster than
CGI::Ex::Template in normal use with mod_perl. CET is only faster if
you use mod_cgi where TT can't do caching. HTML::Template::JIT
compiles your entire template into a C program, so it's hard to
believe that anything else is going to be significantly faster than
that.
At any rate, all of the templating tools discussed so far are more
than fast enough to build a large scale site with.
I didn't know that... I had read many things that CET was 'the way to
go' if you were using any of those packages. I like how it really
just redoes all the backends, so you can switch languages.
anyways, here comes my monthly dose of heresy:
Personally, I only use TAL now, namely via the Petal distribution.
I realized that the biggest issues I had with scaling and performance
were with certain bottlenecks that had a lot to do with the actual
strengths and weaknesses of perl, and not necessarily my code.
( this is aside from db blocking issues )
When it came to crunching number matrices in analytics, image
processing, or handling large file uploads -- perl and mod_perl
couldn't rise to my needs. Perl is heaven with strings -- but its
hell with math, CPU and memory use go too high , as does execution
time. The image resizing quality on Imager, GD and ImageMagick were
all pretty bad ( i thought ) regardless of the quality settings --
and took far too long. MP just isn't good at large file uploads -
too much memory gets lost.
The result I found was to use TAL templates via Petal... and other
languages where they seem fit.
Whenever I run into a math-intensive page or for newer image
processing work, I offload that via the proxy server, onto a
TwistedPython or ModPython server. Whenever I need to handle large
file uploads, or offer a page with templates that are not cached in
memory ( HUGE CONCERN under mp) I have php via fcgi standing by.
in many situations, i can use almost the same exact code/logic -- it
just takes a few minutes to port a section of an app to another
language / framework better suited for it. the difference is often
by a factor of 10-100: pages taking .1 seconds under the python
interpreter where perl needed 1-10; or php spooling the upload to
disk better, without memory concerns.
With TAL, I don't have to worry about anything on the view side. I
just call each page with a standard hash/dict/array/whatever -- i use
the same exact template files, i even call them from my perl document
tree!
None of the other templating systems offered that flexibility. They
all have their own charms though-- TT and Mason are almost
application frameworks more than they are templating libraries.