Posting to cafe since I got just one reply on [EMAIL PROTECTED] I was suggested to include more SCC annotations, but that didn't help. The 'serialize' function is still reported to consume about 32% of running time, 29% inherited. However, functions called from it only account for about 3% of time.

How do I get more insight into that?

Thanks.

--
Vlad Skvortsov, [EMAIL PROTECTED], http://vss.73rus.com

--- Begin Message ---
Hi!

I'm trying to profile the code pasted below. Per the profiler output it takes about 30% of my program running time and I'd like to analyze it further. What I need is a breakdown on a finer level, so I inserted SCC annotations. However, they appear to have attributed zero cost. I use GHC 6.8.2 on FreeBSD, the code is compiled without -O options.

What am I doing wrong?

Note: I'm not trying to *optimize* this code (I intuitively know where the problems are). My intention is to learn the mechanics of profiling Haskell code.


serialize :: Database -> [[String]]
serialize (dmap, tmap) =
 [
   {-# SCC "XXX1" #-} [dbFormatTag],
   {-# SCC "XXX2" #-} (dumpWith docToStr dmap),
   {-# SCC "XXX3" #-} (dumpWith termToStr tmap)
 ]
 where
   dumpWith f = Data.Map.foldWithKey f []
docToStr k (Doc { docName=n, docVectorLength=vl}) =
     (:) ("d " ++ show k ++ " " ++ n ++ " " ++ (show vl))

   termToStr t il =
     (:) ("t " ++ t ++ " " ++ (foldl ilItemToStr "" il))

   ilItemToStr acc (docid, weight) =
     show docid ++ ":" ++ show weight ++ " " ++ acc

--
Vlad Skvortsov, [EMAIL PROTECTED], http://vss.73rus.com



--- End Message ---
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to