seek: defer matcher check until more info is known
Sped up seeking for files to operate on, when using options like --copies or --in, by around 20%. Benchmark showed an increase for --copies from 155 seconds to 121 seconds, and --in remote will be similar to that. For --in here, the speedup was less, 5-10% or so. (both warm cache) This commit was sponsored by Jack Hill on Patreon.
This commit is contained in:
parent
c2d1d4e16e
commit
ace02f41b0
7 changed files with 149 additions and 66 deletions
|
@ -1,6 +1,6 @@
|
|||
{- git-annex limits by wanted status
|
||||
-
|
||||
- Copyright 2012 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2012-2020 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -11,20 +11,27 @@ import Annex.Common
|
|||
import Annex.Wanted
|
||||
import Limit
|
||||
import Types.FileMatcher
|
||||
import Logs.PreferredContent
|
||||
|
||||
addWantGet :: Annex ()
|
||||
addWantGet = addLimit $ Right $ MatchFiles
|
||||
{ matchAction = const $ checkWant $ wantGet False Nothing
|
||||
, matchNeedsFileName = False
|
||||
, matchNeedsFileContent = False
|
||||
}
|
||||
addWantGet = addPreferredContentLimit $
|
||||
checkWant $ wantGet False Nothing
|
||||
|
||||
addWantDrop :: Annex ()
|
||||
addWantDrop = addLimit $ Right $ MatchFiles
|
||||
{ matchAction = const $ checkWant $ wantDrop False Nothing Nothing
|
||||
, matchNeedsFileName = False
|
||||
, matchNeedsFileContent = False
|
||||
}
|
||||
addWantDrop = addPreferredContentLimit $
|
||||
checkWant $ wantDrop False Nothing Nothing
|
||||
|
||||
addPreferredContentLimit :: (MatchInfo -> Annex Bool) -> Annex ()
|
||||
addPreferredContentLimit a = do
|
||||
nfn <- introspectPreferredRequiredContent matchNeedsFileName Nothing
|
||||
nfc <- introspectPreferredRequiredContent matchNeedsFileContent Nothing
|
||||
nk <- introspectPreferredRequiredContent matchNeedsKey Nothing
|
||||
addLimit $ Right $ MatchFiles
|
||||
{ matchAction = const a
|
||||
, matchNeedsFileName = nfn
|
||||
, matchNeedsFileContent = nfc
|
||||
, matchNeedsKey = nk
|
||||
}
|
||||
|
||||
checkWant :: (AssociatedFile -> Annex Bool) -> MatchInfo -> Annex Bool
|
||||
checkWant a (MatchingFile fi) = a (AssociatedFile (Just $ matchFile fi))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue