summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-08-31 19:13:02 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-08-31 19:13:02 -0400
commitf600444ab6d00826cc16c4a5cc67aca84cc1f9e0 (patch)
tree6ee1ed6298d2bc993c62bfc9c2471607f53b6a06
parentea7b1828d48a5dce42393d252f4bbda5cba10d24 (diff)
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.
-rw-r--r--Command/Unused.hs5
-rw-r--r--debian/changelog1
-rw-r--r--doc/todo/git-annex_unused_eats_memory.mdwn6
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 <joeyh@debian.org> 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.