From f600444ab6d00826cc16c4a5cc67aca84cc1f9e0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 31 Aug 2011 19:13:02 -0400 Subject: unused --remote: Reduced memory use to 1/4th what was used before. Using a single strictness annotation, in just the right place. Tried several others, none of which helped and some of which potentially hurt. This is only the second time I've really had to deal with this in a year of using haskell, which is, I suppose not that bad. --- Command/Unused.hs | 5 ++++- debian/changelog | 1 + doc/todo/git-annex_unused_eats_memory.mdwn | 6 ------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Command/Unused.hs b/Command/Unused.hs index e7065b3c3..27f5af1b4 100644 --- a/Command/Unused.hs +++ b/Command/Unused.hs @@ -5,6 +5,8 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE BangPatterns #-} + module Command.Unused where import Control.Monad (filterM, unless, forM_) @@ -80,7 +82,8 @@ checkRemoteUnused' r = do where isthere k = do us <- keyLocations k - return $ uuid `elem` us + let !there = uuid `elem` us + return there uuid = Remote.uuid r writeUnusedFile :: FilePath -> [(Int, Key)] -> Annex () diff --git a/debian/changelog b/debian/changelog index c8c60579e..4ee0b80f2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ git-annex (3.20110820) UNRELEASED; urgency=low * The wget command will now be used in preference to curl, if available. * init: Make description an optional parameter. * unused, status: Sped up by avoiding unnecessary stats of annexed files. + * unused --remote: Reduced memory use to 1/4th what was used before. -- Joey Hess Tue, 23 Aug 2011 13:41:01 -0400 diff --git a/doc/todo/git-annex_unused_eats_memory.mdwn b/doc/todo/git-annex_unused_eats_memory.mdwn index 6ce714004..fcb09a1af 100644 --- a/doc/todo/git-annex_unused_eats_memory.mdwn +++ b/doc/todo/git-annex_unused_eats_memory.mdwn @@ -17,9 +17,3 @@ currently present in the repository (possibly using a bloom filter again), and that would yield a shortlist of keys that are probably not used. Then scan thru all files in the repo to make sure that none point to keys on the shortlist. - ----- - -`git annex unused --from remote` is much worse, using hundreds of mb of -memory. It has not been profiled at all yet, and can probably be improved -somewhat by fixing whatever memory leak it (probably) has. -- cgit v1.2.3