[Templates] adding support for incremental output

Myk Melez myk@mozilla.org
Tue, 12 Mar 2002 14:49:48 +0100


Interestingly, FLUSH appears to increase the overall performance of 
template processing.  The following numbers are from a complicated CGI 
script I templatized.  They compare the original script with the 
templatized version with and without FLUSHing.

I tested each script five times and measured the amount of time it took 
for content to initially appear in my web browser as well as the amount 
of time it took for the page to finish loading.  I generated averages 
for the page load numbers (for the original script I also did an average 
without the significantly different final value).

                        Content Appears (secs)     Page Complete (secs)
original                5,5,5,5,5                  44,44,40,42,52 (44.4/42.5)
templatized             13,13,13,13,14             58,57,53,51,55 (54.8)
templatized w/flush     7,6,6,6,6                  46,43,45,44,45 (44.6)

These numbers show an expected decrease in time to initial content when 
using FLUSH, but surprisingly they also show a significant decrease in 
overall time.  These results are very preliminary, and I don't know why 
this would happen, but the data does suggest that flushing to the output 
stream regularly could significantly increase the general performance of 
the Template Toolkit.

-myk