git-annex/doc/bugs/__96__lookupkey__96___unexpectedly_slow.mdwn
Joey Hess f8d35d9480
lookupkey: Sped up --batch
When the file is relative, it does not need to be passed
through git lsfiles to normalize it.

Sponsored-by: Kevin Mueller on Patreon
2023-10-30 14:59:09 -04:00

25 lines
1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### Please describe the problem.
I need to discover a potentially existing annex-key for any file in the worktree of a Git repository. I assumed that a batch-mode `lookupkey` would be faster than a `find --json --batch`, but that is not the case.
My test repository has 36k files.
```
time git ls-files | git annex lookupkey --batch > /dev/null
git ls-files 0.01s user 0.01s system 0% cpu 2:42.37 total
git annex lookupkey --batch > /dev/null 91.00s user 73.39s system 98% cpu 2:46.25 total
time git ls-files | git annex find --anything --json --batch > /dev/null
git ls-files 0.01s user 0.00s system 0% cpu 4.093 total
git annex find --anything --json --batch > /dev/null 3.20s user 2.02s system 124% cpu 4.195 total
```
`lookupkey` appears to be many times slower than `find`, although the latter reports much more information.
This surprised me, hence I am reporting it here as a potential bug.
### What version of git-annex are you using? On what operating system?
git-annex version: 10.20230126
> [[fixed|done]] --[[Joey]]