[Haskell-beginners] code critique
aditya siram
aditya.siram at gmail.com
Wed Jul 27 07:34:36 CEST 2011
I just profiled all three and have not found them to be different.
Maybe I'm reading my profiler output wrong so I've pasted it below.
The compilation command I used was:
ghc -fforce-recomp -XBangPatterns -prof -rtsopts -auto-all -o
ListCrossProductSum ListCrossProductSum.hs
They were all invoked using:
main = print $ sumCheck 5000 [1..10000] [1..10000]
I am running GHC 7.0.1
-deech
sumcheck1:
==========
Wed Jul 27 00:26 2011 Time and Allocation Profiling Report (Final)
ListCrossProductSum +RTS -p -RTS
total time = 0.00 secs (0 ticks @ 20 ms)
total alloc = 344,084 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
sums Main 0.0 40.7
main Main 0.0 58.3
individual inherited
COST CENTRE MODULE
no. entries %time %alloc %time %alloc
MAIN MAIN
1 0 0.0 0.0 0.0 100.0
CAF Main
240 2 0.0 0.2 0.0 99.2
main Main
246 1 0.0 58.3 0.0 99.0
sumCheck Main
247 1 0.0 0.0 0.0 40.7
sums Main
248 1 0.0 40.7 0.0 40.7
CAF GHC.Show
236 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Handle.FD
176 2 0.0 0.4 0.0 0.4
CAF System.Posix.Internals
175 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Handle.Internals
140 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding.Iconv
134 2 0.0 0.3 0.0 0.3
CAF GHC.Conc.Signal
131 1 0.0 0.1 0.0 0.1
sumcheck2
=========
[1 of 1] Compiling Main ( ListCrossProductSum.hs,
ListCrossProductSum.o )
True
Wed Jul 27 00:27 2011 Time and Allocation Profiling Report (Final)
ListCrossProductSum +RTS -p -RTS
total time = 0.00 secs (0 ticks @ 20 ms)
total alloc = 344,084 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
sums Main 0.0 40.7
main Main 0.0 58.3
individual inherited
COST CENTRE MODULE
no. entries %time %alloc %time %alloc
MAIN MAIN
1 0 0.0 0.0 0.0 100.0
CAF Main
240 2 0.0 0.2 0.0 99.2
main Main
246 1 0.0 58.3 0.0 99.0
sumCheck Main
247 1 0.0 0.0 0.0 40.7
sums Main
248 1 0.0 40.7 0.0 40.7
CAF GHC.Show
236 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Handle.FD
176 2 0.0 0.4 0.0 0.4
CAF System.Posix.Internals
175 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Handle.Internals
140 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding.Iconv
134 2 0.0 0.3 0.0 0.3
CAF GHC.Conc.Signal
131 1 0.0 0.1 0.0 0.1
sumcheck3
=========
ListCrossProductSum +RTS -p -RTS
total time = 0.00 secs (0 ticks @ 20 ms)
total alloc = 344,084 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
sums Main 0.0 40.7
main Main 0.0 58.3
individual inherited
COST CENTRE MODULE
no. entries %time %alloc %time %alloc
MAIN MAIN
1 0 0.0 0.0 0.0 100.0
CAF Main
240 2 0.0 0.2 0.0 99.2
main Main
246 1 0.0 58.3 0.0 99.0
sumCheck Main
247 1 0.0 0.0 0.0 40.7
sums Main
248 1 0.0 40.7 0.0 40.7
CAF GHC.Show
236 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Handle.FD
176 2 0.0 0.4 0.0 0.4
CAF System.Posix.Internals
175 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Handle.Internals
140 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding.Iconv
134 2 0.0 0.3 0.0 0.3
CAF GHC.Conc.Signal
131 1 0.0 0.1 0.0 0.1
More information about the Beginners
mailing list