Timing repeated function calls

Jeffrey A. Scofield sja10587@qwest.net
Mon, 11 Aug 2003 10:06:00 -0700

Malcom Wallace wrote:

> Since you aren't interested in absolute timings, just the algorithmic
> complexity, then you could try using a less smart compiler (e.g. nhc98)
> which will not automatically optimise away the repeated calls.

Thanks very much, I will try this.

I'm seriously interested in using Haskell in a commercial venture,
and this kind of discussion helps me see what techniques we would
have in our toolkit.  In the past (20 years of imperative programming)
I have occasionally found it useful to be able to get timings for
some little function that is in the inner loops of an application.

I would be very interested to hear if there are any theoretically
pure ways to get timing measurements for a very short-running
function.  The problem, I think, is that you want to apply the
function to the same arguments repeatedly so as not to spend all
your time creating arguments.