[Haskell-cafe] measure a function in ghci

Jochem Berndsen jochem at functor.nl
Wed Jun 3 15:04:06 EDT 2009

Nico Rolle wrote:
> 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.

For simple testing in the interactive environment, use
:set +s
and after each evaluation the memory usage and the number of elapsed
seconds will be displayed.

If you want more, look up the profiling support in the documentation of GHC
GHC provides both memory and time profiling.


Jochem Berndsen | jochem at functor.nl

More information about the Haskell-Cafe mailing list