Analyzing Efficiency
Ketil Z. Malde
ketil@ii.uib.no
14 Aug 2002 08:56:46 +0200
"Shawn P. Garbett" <Shawn@Garbett.org> writes:
> I've come up with three different methods of approach to solve the same
> problem in haskell. I would like to compare the three in terms of reductions,
> memory usage, and overall big O complexity.
>
> What's the quickest way to gather these stats?
I don't know about quickest, but if you haven't yet tried GHC's
profiling, this might be a good time to do so.
Build your project, using e.g.
ghc --make -prof -auto-all ...
(I like to add '-hisuf p.hi -osuf p.o' in order to keep files apart
from non-profiling builds, since linking with both kinds will crash
your program)
Then run it with
./a.out (or whatever) +RTS -p -RTS
and look at the resulting file a.out.prof. Replace -p with -h to do
heap profiling. Have a look at the online GHC documentation for all
the details, it's pretty comprehensive and readable, IMO.
-kzm
--
If I haven't seen further, it is by standing in the footprints of giants