It is apropriate to have initilization code in your
benchmarking routines. Having initilization code will
impact the absolute performance of the code by its added
overhead. However, when you use Benchmark/timethere
you are looking to determine the relative
performance of a piece of code. As long as you use
the same initilization routine in all pieces of code being
benchmarked your results will be valid and useful.
If you really want to knoe the absolute performance,
you can also run a dummy example along with your real
code that contains only the initilization
routine and you can factor out the initilization routine's
effect when analyzing the results.
Oh yes,
I agree completely lhoward. I think what I was trying to say last night was
that init code should be done by hand, not by timethese. And as you point out
init code can still be factored out of a benchmark, if you still feel
obsessive about it.