cache negative lookups of global numcopies and mincopies
Speeds up eg git-annex sync --content by up to 50%. When it does not need to transfer or drop anything, it now noops a lot more quickly. I didn't see anything else in sync --content noop loop that could really be sped up. It has to cat git objects to keys, stat object files, etc. Sponsored-by: unqueued on Patreon
This commit is contained in:
parent
4437e187e6
commit
3c15e0f7a0
5 changed files with 38 additions and 6 deletions
|
@ -45,22 +45,22 @@ setGlobalMinCopies new = do
|
|||
|
||||
{- Value configured in the numcopies log. Cached for speed. -}
|
||||
getGlobalNumCopies :: Annex (Maybe NumCopies)
|
||||
getGlobalNumCopies = maybe globalNumCopiesLoad (return . Just)
|
||||
getGlobalNumCopies = maybe globalNumCopiesLoad return
|
||||
=<< Annex.getState Annex.globalnumcopies
|
||||
|
||||
{- Value configured in the mincopies log. Cached for speed. -}
|
||||
getGlobalMinCopies :: Annex (Maybe MinCopies)
|
||||
getGlobalMinCopies = maybe globalMinCopiesLoad (return . Just)
|
||||
getGlobalMinCopies = maybe globalMinCopiesLoad return
|
||||
=<< Annex.getState Annex.globalmincopies
|
||||
|
||||
globalNumCopiesLoad :: Annex (Maybe NumCopies)
|
||||
globalNumCopiesLoad = do
|
||||
v <- getLog numcopiesLog
|
||||
Annex.changeState $ \s -> s { Annex.globalnumcopies = v }
|
||||
Annex.changeState $ \s -> s { Annex.globalnumcopies = Just v }
|
||||
return v
|
||||
|
||||
globalMinCopiesLoad :: Annex (Maybe MinCopies)
|
||||
globalMinCopiesLoad = do
|
||||
v <- getLog mincopiesLog
|
||||
Annex.changeState $ \s -> s { Annex.globalmincopies = v }
|
||||
Annex.changeState $ \s -> s { Annex.globalmincopies = Just v }
|
||||
return v
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue