avoid double work in git-annex init, second try
authorJoey Hess <joeyh@joeyh.name>
Tue, 8 Jun 2021 13:27:53 +0000 (09:27 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 8 Jun 2021 13:36:53 +0000 (09:36 -0400)
commitc941ab6f5b98becfa2880cb69cbc2c4a39057cd9
tree3488cd1b6e02b786fcb00281e9e7f81e2a7658a8
parent22185b4a4eb91a7011c36faba6d15415b06b7abd
avoid double work in git-annex init, second try

reconcileStaged populates the db, so scanAnnexedFiles does not need to
do it again. It still makes a pass over the HEAD tree, but populating
the db was most of the expensive part.

Benchmarking with 100,000 files, git-annex init now takes 40 seconds,
vs 37 seconds with the old, buggy version of this fix. It should be
possible to win those 3 precious seconds per 100k files back, in the
case when when annex.thin is not set, with improvements to reconcileStaged
that avoid needing this second pass.

Sponsored-by: Dartmouth College's Datalad project
Annex/WorkTree.hs
Database/Keys.hs
Database/Keys/SQL.hs