[Haskell-cafe] measure a function in ghci

Jason Dagit dagit at codersbase.com
Wed Jun 3 15:20:09 EDT 2009

On Wed, Jun 3, 2009 at 11:47 AM, Nico Rolle <nrolle at web.de> wrote:

> hi there
> is there a quick way to check which function is doing the job quicker?
> i have 2 functions which i want to compare.
> both give the same output but they do it in different manner.
> i want to test which one is faster.
> i use ghci.

Be wary of timing things in GHCi.  By default there are no optimizations in
ghci so you could find that one implementation is much worse than the other
but the situation might be completely different when optimizations are
enabled.  I'm pretty sure if you start ghci with the -O flag that it will
use optimizations.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090603/3c445583/attachment.html

More information about the Haskell-Cafe mailing list