[darcs-users] darcs patch: optimize firstspace/firstnonspace to remove boxed retu...

Ian Lynagh igloo at earth.li
Mon Sep 28 10:37:48 UTC 2009


On Sun, Sep 27, 2009 at 03:10:01PM -0700, Jason Dagit wrote:
> 
> While profiling away on darcs I discovered that we create a lot of
> intermediate garbage while parsing due to what is otherwise a very,
> very small intermediate allocation.
> 
> What maginfies this allocation into a problem is that we're allocating
> an int for each element of the bytestrings that we traverse with this
> function.  GHC is unable to optimize this because in the IO monad it
> must return a boxed int instead of an unboxed int.

MagicHash should be avoided wherever possible, IMO.

Can you give a small, standalone program showing the problem and your
solution, please?


Thanks
Ian



More information about the darcs-users mailing list