[Haskell-beginners] Profiling haskell code

Sayali Kulkarni Sayali.Kulkarni at kpitcummins.com
Thu Dec 4 07:12:42 EST 2008

Hey thanks Brent. This helped.

I have one more question now.

Consider I have two functions 
1. gives me a range of numbers in an array.
2. has to get an array input for further process.

Then how can I get the array generated by the first function tobe the
input of the second function?


-----Original Message-----
From: Brent Yorgey [mailto:byorgey at seas.upenn.edu] 
Sent: Tuesday, November 18, 2008 5:47 PM
To: Sayali Kulkarni
Subject: Re: [Haskell-beginners] Profiling haskell code

> I have just given it any random input array to be sorted.
> The commands that I had sent earlier were tried on Cygwin...
> (
> > > $ ghc --make Project.hs -prof -auto-all
> > >  
> > >  
> > > $ Project +RTS -p
> > >  ) 

This ought to work fine.  Just a note, to do any reasonable profiling
you will need to give it a *much* larger list to sort.  Otherwise it
execute so quickly that the timing data you get will be meaningless.

> Also can you tell me any other method for profiling the code that you
> know? 

If you just want to see how long it takes to evaluate certain
expressions, you can type ':set +s' in ghci; from then on after every
expression you type it will tell you how long it took to evaluate and
how much memory was used.


More information about the Beginners mailing list