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