I recently ran some performance tests in which I compared 2.04 with 2.06
and subsequent developer releases. The difference between 2.04 and 2.06
is statistically insignificant; 2.06a-c are slightly slower than 2.06;
and 2.06d is much slower.
I tested the releases by measuring the time it took to make 50 requests
for a heavily templatized CGI script. I ran with both the regular and
the XS stash, and for 2.06c and 2.06d I ran both with and without the
COMPILE_DIR option. Here are the results:
regular XS stash XS+compile
TT 2.04 2m45.526s n/a
TT 2.06 2m43.890s 1m33.740s
TT 2.06b 2m56.156s 1m41.711s
TT 2.06c 3m0.713s 1m43.340s 1m42.189s
TT 2.06d 3m52.811s 2m36.864s 2m21.715s
Small amounts of performance degradation over time can end up making a
big difference in the responsiveness and feel of templatized
applications, so it's worthwhile to figure out why the developer
releases are slower than the last stable release, especially 2.06d.
The reason this is important to me is that the pre-templatized version
of the script in question does the same test in 38 seconds (2-3 times
faster than the fastest templatized version). I expect that templates
will always be slower than hand-coded Perl (a fault which is more than
made up for by their flexibility and other advantages), but this
difference may be more than my users and fellow developers can bear.
So, besides enabling the XS stash and COMPILE_DIR options and using
PROCESS instead of INCLUDE when possible, what other measures can I take
to wring the most performance out of my templates?
-myk