ketil:
> Andrew Coppin <[EMAIL PROTECTED]> writes:
> 
> > I'm more worried about what happens in less trivial examples. [Let's
> > face it, who wants to compute the sum of the numbers from 1 to N?]
> 
> Inspired by Don's blog post, and coincidentally working on a program
> where profiling points to one particular, short function as
> responsible for 60% of the work, I thought this would be a good time
> to look into core and reveal the deep secrets of my code.  This is the
> function: 
> 
> > mkAnn :: ByteString -> Annotation
> > mkAnn = pick . B.words
> >     where pick (_db:up:rest) = pick' up $ getGo rest
> >           pick' up' (go:_:ev:_) = Ann (B.copy up') (read $ B.unpack go) 
> > (read $ B.unpack ev)
> >           getGo = dropWhile (not . B.isPrefixOf (pack "GO:"))
> 

    read $ B.unpack go

Looks suspicious. You're unpacking to lists.

ByteString performance rule 1: don't unpack to lists.

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

Reply via email to