[Haskell-cafe] measuring time differences between functions

Nico Rolle nrolle at web.de
Wed Jun 17 14:25:08 EDT 2009

Hi everyone.
I made parallel versions of my functions projection selection and sort
and i wanted to test the difference in runtime.
But he only printed 0.00 twice.
Maybe hes just too fast?
Or is it because of lazy evaluation?
or is there a better way to mesure performance in execution time?

main = do
    xs <- readCSV "dataconvert/lineitem.tbl" '|'
    start <- getCurrentTime
    let pnp = projection [5] xs
    let snp = selection (\x -> (x!!0) > (Int 17000)) pnp
    let sortnp = sort [0] [ASC] snp
    end <- getCurrentTime
    putStrLn $ show (end `diffUTCTime` start)
    start2 <- getCurrentTime
    let pp = pProjection [5] xs
    let sp = pSelection (\x -> (x!!0) > (Int 17000)) pp
    let sortp = pSort [0] [ASC] sp
    end2 <- getCurrentTime
    putStrLn $ show (end2 `diffUTCTime` start2)
    return snp

More information about the Haskell-Cafe mailing list