summaryrefslogtreecommitdiff
path: root/Command
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 /Command
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.
Diffstat (limited to 'Command')
-rw-r--r--Command/Unused.hs5
1 files changed, 4 insertions, 1 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 ()