Often when developing a Movable Type template, I come up with multiple ways to generate the same result, and am curious which is more efficient. Or, I simply want to know how long something took, such as generating search results.
Is there an easy way to recording processing time or other timing strategies using template tags without requiring external tools?
This is the method I came up with and have been using for some time. It reports timing to the nearest second, making use of standard Movable Type template language.
To time a chunk of template code, create a system or blog level template module called "timing":
Then, in a template you want to time something in, place these two lines at the start and end of the chunk of interest:
You could of course add a line of output in the "start" section if you want to denote in the output where the timing started.
Or you could use the debug mode 8 as explained here: http://www.movabletype.org/documentation/developer/plugins/debug-mode.html
There's also an option (in the same General Settings panel as the debug mode) to activate a performance log with a threshold value.