On Wed, Oct 22, 2014 at 12:48:53PM +0200, Daniel Trstenjak wrote:
>
> Hi Magnus,
>
>> When playing around with various implementations of a single
>> function it would be nice to time the execution. Is there some way
>> to do that easily from within GHCi?
>
> ghci normally only interprets your code, without much optimizations,
> so your timings might be quite misleading.
Well, it might be enough to confirm or disprove intuitions about time
complexity of an implementation; is it O(n) or O(n^2)? And that's
really what I'd like to see at a first step.
Given that all I'm interested in is relative timings it might even be
enough to do a rough comparison of two implementations too.
>> Or am I forced to look to criterion for that?
>
> I think so, if you want to trust your timings.
It's just a bit too much ceremony when all I want is to confirm that
"inserting in reversed order followed by a `reverse`" has less time
complexity than "repeated appending."
Of course the only way to get something I can take to the bank is
using criterion.