optimisation
authorJoey Hess <joeyh@joeyh.name>
Tue, 20 Apr 2021 17:13:45 +0000 (13:13 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 20 Apr 2021 17:13:45 +0000 (13:13 -0400)
Avoid unnecessary conversion to/from String.

Annex/Branch.hs
Annex/Journal.hs

index ce4434e73bd35dcdb2b1b08e677c2bc30860313b..3acb12975b366501bbb37fe75c33804caf05eaf3 100644 (file)
@@ -411,7 +411,7 @@ files = do
        -- so use getJournalledFilesStale which should be much smaller most
        -- of the time. branchFiles will stream as the list is consumed.
        l <- (++)
-               <$> (map toRawFilePath <$> getJournalledFilesStale)
+               <$> getJournalledFilesStale
                <*> pure bfs
        return (l, cleanup)
 
index a8269a7e5910c4dc74d9f95c39d3b692d1d125e1..25522bb89c2a2bca70be3308bf1c498c6b2fe709 100644 (file)
@@ -9,6 +9,8 @@
  - Licensed under the GNU AGPL version 3 or higher.
  -}
 
+{-# LANGUAGE OverloadedStrings #-}
+
 module Annex.Journal where
 
 import Annex.Common
@@ -78,13 +80,13 @@ getJournalFileStale file = inRepo $ \g -> catchMaybeIO $
 {- List of existing journal files, but without locking, may miss new ones
  - just being added, or may have false positives if the journal is staged
  - as it is run. -}
-getJournalledFilesStale :: Annex [FilePath]
+getJournalledFilesStale :: Annex [RawFilePath]
 getJournalledFilesStale = do
        g <- gitRepo
        fs <- liftIO $ catchDefaultIO [] $
                getDirectoryContents $ fromRawFilePath $ gitAnnexJournalDir g
        return $ filter (`notElem` [".", ".."]) $
-               map (fromRawFilePath . fileJournal . toRawFilePath) fs
+               map (fileJournal . toRawFilePath) fs
 
 withJournalHandle :: (DirectoryHandle -> IO a) -> Annex a
 withJournalHandle a = do