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.
This commit is contained in:
Joey Hess 2011-08-31 19:13:02 -04:00
parent ea7b1828d4
commit f600444ab6
3 changed files with 5 additions and 7 deletions

View file

@ -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 ()

1
debian/changelog vendored
View file

@ -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

View file

@ -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.