Sped up the initial scanning for annexed files by 15%
Avoids database querying overhead when the database is newly created. In the large repository where git-annex init took 24 seconds, this sped it up to 20.47 seconds, a speedup of around 15%. Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
parent
a3e9a0ae27
commit
8fcee4ac9d
4 changed files with 32 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
{- Sqlite database of information about Keys
|
||||
-
|
||||
- Copyright 2015-2021 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2015-2022 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -88,6 +88,15 @@ addAssociatedFile k f = queueDb $
|
|||
where
|
||||
af = SFilePath (getTopFilePath f)
|
||||
|
||||
-- Faster than addAssociatedFile, but only safe to use when the file
|
||||
-- was not associated with a different key before, as it does not delete
|
||||
-- any old key.
|
||||
newAssociatedFile :: Key -> TopFilePath -> WriteHandle -> IO ()
|
||||
newAssociatedFile k f = queueDb $
|
||||
void $ insert $ Associated k af
|
||||
where
|
||||
af = SFilePath (getTopFilePath f)
|
||||
|
||||
{- Note that the files returned were once associated with the key, but
|
||||
- some of them may not be any longer. -}
|
||||
getAssociatedFiles :: Key -> ReadHandle -> IO [TopFilePath]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue