On Wednesday 11 March 2015 23:40:39 Oleksii Oleksenko wrote:
> - Profiling
> - run profiler (cProfile?) on all of these tests. As I see, basic
> algorithm (pseudo code) will look like this:
>
> for context, template in zip(contexts, templates):
> t = Template(template)
> c = Context(context)
> start profiler
> t.render(c)
> stop profiler
> store profiling results
>
The profiler can be useful when you're trying to optimize a given piece of
code, but it also changes your measurements; the most obvious example is,
since the profiler "takes notes" on every function call, code with a lot of
function calls will look worse in the profiler than it really is. So, for
identifying which piece of code to optimize -- for your very initial
performance analysis -- I would just use timeit.
HTH,
Shai.