This post briefly introduces some tools for getting accurate estimates of running times for publishing pages when optimizing templates. There are certainly better ways to measure page publishing time than with a stopwatch!
“ Times flies like an arrow. ”
A while back, I was working with my coworkers to speed up publishing times of pages for one of our clients. Our approach was to rework page templates to be more efficient, as there were many sluggish aspects to existing page templates in use. Some of the techniques we ended up using are discussed here.
Initially, we were looking at speeding up pages run through Template Builder, but quickly realized that this is not necessarily an accurate representation of publishing times. So we switched focus directly to publishing, instead of previewing pages or running them through Template Builder.
To get some quick readings, we started working with a stopwatch and recorded start and end times of multiple runs of various templates before and after supposed improvements. However, the accuracy of this method proved shaky, since being off by even one second could really mess up the analysis. An average of even one second of improvement would be significant, say, on a page that takes 20 seconds to publish (for a 5% decrease).
So we decided to whip up some C# fragments to replace our stopwatch. Here you can find a couple C# code snippets that you can add to the start and end of your page templates to append an accurate reading of the publishing time of a your page as an XML/HTML comment. Then, if there really is a one second increase, you should be able to detect it!