speed up very first tree import by 25%
authorJoey Hess <joeyh@joeyh.name>
Fri, 2 Jun 2023 17:30:30 +0000 (13:30 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 2 Jun 2023 17:30:30 +0000 (13:30 -0400)
commitfe1b2dfb4bd0554270d1bad8511b64e782513918
tree2655989629b56f6b758005de2aeb9bdf79125ce7
parentb43fb4923f6465cd099bbcb5a88c35cc85ffb02e
speed up very first tree import by 25%

Reading from the cidsdb is responsible for about 25% of the runtime of
an import. Since the cidmap is used to store the same information in
ram, the cidsdb is not written to during an import any longer. And so,
if it started off empty (and updateFromLog wasn't needed), those reads
can just be skipped.

This is kind of a cheesy optimisation, since after any import from any
special remote, the database will no longer be empty, so it's a single
use optimisation. But it's probably not uncommon to start by importing a
lot of files, and it can save a lot of time then.

Sponsored-by: Brock Spratlen on Patreon
Annex/Import.hs
CHANGELOG
Database/ContentIdentifier.hs
Remote/Helper/ExportImport.hs