From 7ff89ccfee13dcfe89cbdef83454e880dabd7186 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 29 Sep 2011 23:43:42 -0400 Subject: convert all git read/write functions to use ByteStrings This yields a second or so speedup in unused, find, etc. Seems that even when the ByteString is immediately split and then converted to Strings, it's faster. I may try to push ByteStrings out into more of git-annex gradually, although I suspect most of the time-critical parts are already covered now, and many of the rest rely on libraries that only support Strings. --- Branch.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Branch.hs') diff --git a/Branch.hs b/Branch.hs index 92b1fe29e..e4caeece7 100644 --- a/Branch.hs +++ b/Branch.hs @@ -30,6 +30,7 @@ import System.IO import System.IO.Binary import System.Posix.Process import System.Exit +import qualified Data.ByteString.Lazy.Char8 as L import Types.BranchState import qualified Git @@ -181,7 +182,7 @@ siblingBranches :: Annex [String] siblingBranches = do g <- Annex.gitRepo r <- liftIO $ Git.pipeRead g [Param "show-ref", Param name] - return $ map (last . words) (lines r) + return $ map (last . words . L.unpack) (L.lines r) {- Ensures that a given ref has been merged into the index. -} updateRef :: GitRef -> Annex (Maybe String) @@ -196,7 +197,7 @@ updateRef ref Param (name++".."++ref), Params "--oneline -n1" ] - if null diffs + if L.null diffs then return Nothing else do showSideAction $ "merging " ++ Git.refDescribe ref ++ " into " ++ name -- cgit v1.2.3