
Hello everyone, I did at my master thesis a compiler that generates Haskell code. Now I need to measure the execution time of my generated code and I've been searched and I don't know if I'm looking with the wrong keywords but I could not find anything. I just need to measure the time of simple functions, like Ackermann and Fibonacci. Does anyone know how to measure the execution time of a Haskell program or function? Thank you, Tays __________________________________________________ Fale com seus amigos de graça com o novo Yahoo! Messenger http://br.messenger.yahoo.com/

Hi Tays,
I did at my master thesis a compiler that generates Haskell code. Now I need to measure the execution time of my generated code and I've been searched and I don't know if I'm looking with the wrong keywords but I could not find anything. I just need to measure the time of simple functions, like Ackermann and Fibonacci. Does anyone know how to measure the execution time of a Haskell program or function?
Does the unix command "time" not work? (if you are on windows I have a variant from Bulat that does the same on Windows) The CPUTime module also has some useful bits. Thanks Neil

GHC has profiling support.
(By the way, many mail servers these days discard mail with no subject.)
I've seen a number of papers comparing the speed of Haskell code to code of other functional languages; there is a periodic "shoot out" with ocaml.
Some probably have comparisons with imperative languages, and, even if they do not, the methodology should help you.
Seth Kurtzberg
On Mon, 5 Feb 2007 11:28:03 -0800 (PST)
Tays Soares
Hello everyone,
I did at my master thesis a compiler that generates Haskell code. Now I need to measure the execution time of my generated code and I've been searched and I don't know if I'm looking with the wrong keywords but I could not find anything. I just need to measure the time of simple functions, like Ackermann and Fibonacci. Does anyone know how to measure the execution time of a Haskell program or function?
Thank you, Tays
__________________________________________________ Fale com seus amigos de graça com o novo Yahoo! Messenger http://br.messenger.yahoo.com/

Hi Tays,
If I understood correctly, if your compiler generates Haskell code, then
later on you should compile this code (with GHC, for example) and running it
implies a main function that is of the tipe IO() (i.e. IO Monad).
What you can do is to add (it could be, for example, in debugging mode in
your compiler) the code i paste below at the beginning and in the end of
your main function.
Well, I don't know exactly if this answers your question. If it doesn't, my
apologies.
Cheers
Cristian
import System.Time
import Text.Printf
{
; timeStart <- getClockTime
... your process
; timeEnd <- getClockTime
; let diff = (normalizeTimeDiff (diffClockTimes timeEnd timeStart))
; print ((((fromIntegral(tdPicosec diff))/(10^12))) +
(fromIntegral((tdSec diff) + (60 * (tdMin diff)) + (3600 * (tdHour diff)))))
; return ()
}
On 2/6/07, Seth Kurtzberg
GHC has profiling support.
(By the way, many mail servers these days discard mail with no subject.)
I've seen a number of papers comparing the speed of Haskell code to code of other functional languages; there is a periodic "shoot out" with ocaml.
Some probably have comparisons with imperative languages, and, even if they do not, the methodology should help you.
Seth Kurtzberg
On Mon, 5 Feb 2007 11:28:03 -0800 (PST) Tays Soares
wrote: Hello everyone,
I did at my master thesis a compiler that generates Haskell code. Now I need to measure the execution time of my generated code and I've been searched and I don't know if I'm looking with the wrong keywords but I could not find anything. I just need to measure the time of simple functions, like Ackermann and Fibonacci. Does anyone know how to measure the execution time of a Haskell program or function?
Thank you, Tays
__________________________________________________ Fale com seus amigos de graça com o novo Yahoo! Messenger http://br.messenger.yahoo.com/
Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (4)
-
Cristian Perfumo
-
Neil Mitchell
-
Seth Kurtzberg
-
Tays Soares