[darcs-users] darcs patch: Improve memory usage of darcs check and ... (and 1 more)

Eric Kow kowey at darcs.net
Tue Mar 10 19:04:08 UTC 2009


[top-posting because I'm not sure if Bertram is on this list and
 therefore if he received Petr's reply]

Hi Bertram,

I'll apply this, but could you run the standard darcs benchmarks
(maybe improving them as needed) and send us some results?

  http://wiki.darcs.net/index.html/StandardDarcsBenchmarks

Thanks!

On Tue, Mar 10, 2009 at 19:44:11 +0100, Petr Rockai wrote:
> Hi,
> 
> > Improve memory usage of darcs check and repair.
> > -----------------------------------------------
> >> Bertram Felgenhauer <int-e at gmx.de>**20090310120357
> >>  'applyAndFix' in D.Repository.Repair kept all processed patches around,
> >>  but only their info is actually needed.
> >> ] hunk ./src/Darcs/Repository/Repair.hs 83
> >>            aaf s NilFL = return ([], s, True)
> >>            aaf s (p:>:ps) = do
> >>              (s', mp') <- run_slurpy s $ applyAndTryToFix p
> >> -            finishedOneIO k $ show $ human_friendly $ info p
> >> +            let !infp = info p -- assure that 'p' can be garbage collected.
> >> +            finishedOneIO k $ show $ human_friendly $ infp
> Interesting. This indeed seems to make sense, however I have profiled the
> current code before and haven't seen any leaks (ie. the profile looked pretty
> flat). However, it might be that the reference to 'info p' post-recursion crept
> in only later than I have done my profiling, which would explain it. Either
> that or something else.
> 
> Also, a summary of how it affects actual memory usage would be great. I could
> look into that, although my time is currently rather limited. Either way, I'll
> do a benchmark run in a near future, comparing 2.2 against current trunk, so at
> that point, how much this patch helps (it should help a lot if the problem it
> fixes is really happening, which is hard to discern for me right now).
> 
> >>              s'' <- syncSlurpy (update_slurpy r c opts) s'
> >>              (ps', s''', restok) <- aaf s'' ps
> >>              case mp' of
> >> hunk ./src/Darcs/Repository/Repair.hs 91
> >>                Nothing -> return (ps', s''', restok)
> >>                Just (e,pp) -> do putStrLn e
> >>                                  p' <- makePatchLazy r pp
> >> -                                return ((info p, p'):ps', s''', False)
> >> +                                return ((infp, p'):ps', s''', False)
> I suppose this is the crucial bit, since if 'info p' wouldn't have been used
> after the recursive call, p would be dead and therefore collectible.
> 
> As far as correctness of the post-patch code is concerned, I believe the patch
> doesn't change semantics at all, so it should be perfectly safe.
> 
> Yours,
>    Petr.
> 
> -- 
> Peter Rockai | me()mornfall!net | prockai()redhat!com
>  http://blog.mornfall.net | http://web.mornfall.net

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090310/d7e0d28e/attachment.pgp>


More information about the darcs-users mailing list