import: Sped up import from special remote when the imported tree is unchanged
I saw a nearly 2 minute speed up from this, in a repo with 56000 files some of which are preferred content of the special remote and others not. In such a case, addBackExportExcluded has to do a lot of work, which is unncessary when the tree is unchanged. When using sync --content, preferred content checking of that many files takes about 1 minute. So this speeds up sync --content by 3x. When using git-annex import, the speed up is much larger. Sponsored-by: Nicholas Golder-Manning on Patreon
This commit is contained in:
parent
1e775ab83b
commit
a5b9c2ca69
2 changed files with 21 additions and 12 deletions
|
@ -223,21 +223,28 @@ buildImportCommit' remote importcommitconfig mtrackingcommit imported@(History t
|
||||||
-- nothing new needs to be committed.
|
-- nothing new needs to be committed.
|
||||||
-- (This is unlikely to happen.)
|
-- (This is unlikely to happen.)
|
||||||
| sametodepth h' = return Nothing
|
| sametodepth h' = return Nothing
|
||||||
| otherwise = do
|
-- If the imported tree is unchanged,
|
||||||
importedcommit <- case getRemoteTrackingBranchImportHistory h of
|
-- nothing new needs to be committed.
|
||||||
Nothing -> mkcommitsunconnected imported
|
| otherwise = getLastImportedTree remote >>= \case
|
||||||
Just oldimported@(History oldhc _)
|
Just (LastImportedTree lasttree)
|
||||||
| importeddepth == 1 ->
|
| lasttree == ti -> return Nothing
|
||||||
mkcommitconnected imported oldimported
|
_ -> gencommit trackingcommit h
|
||||||
| otherwise -> do
|
|
||||||
let oldimportedtrees = mapHistory historyCommitTree oldimported
|
|
||||||
mknewcommits oldhc oldimportedtrees imported
|
|
||||||
ti' <- addBackExportExcluded remote ti
|
|
||||||
Just <$> makeRemoteTrackingBranchMergeCommit'
|
|
||||||
trackingcommit importedcommit ti'
|
|
||||||
where
|
where
|
||||||
h'@(History t s) = mapHistory historyCommitTree h
|
h'@(History t s) = mapHistory historyCommitTree h
|
||||||
|
|
||||||
|
gencommit trackingcommit h = do
|
||||||
|
importedcommit <- case getRemoteTrackingBranchImportHistory h of
|
||||||
|
Nothing -> mkcommitsunconnected imported
|
||||||
|
Just oldimported@(History oldhc _)
|
||||||
|
| importeddepth == 1 ->
|
||||||
|
mkcommitconnected imported oldimported
|
||||||
|
| otherwise -> do
|
||||||
|
let oldimportedtrees = mapHistory historyCommitTree oldimported
|
||||||
|
mknewcommits oldhc oldimportedtrees imported
|
||||||
|
ti' <- addBackExportExcluded remote ti
|
||||||
|
Just <$> makeRemoteTrackingBranchMergeCommit'
|
||||||
|
trackingcommit importedcommit ti'
|
||||||
|
|
||||||
importeddepth = historyDepth imported
|
importeddepth = historyDepth imported
|
||||||
|
|
||||||
sametodepth b = imported == truncateHistoryToDepth importeddepth b
|
sametodepth b = imported == truncateHistoryToDepth importeddepth b
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
git-annex (10.20231228) UNRELEASED; urgency=medium
|
git-annex (10.20231228) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* info: Added "annex sizes of repositories" table to the overall display.
|
* info: Added "annex sizes of repositories" table to the overall display.
|
||||||
|
* import: Sped up import from special remote when the imported tree is
|
||||||
|
unchanged.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 29 Dec 2023 11:52:06 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 29 Dec 2023 11:52:06 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue