add: speed up cmd_add() by utilizing read_cache_preload()
authorBen Peart <redacted>
Fri, 2 Nov 2018 13:30:50 +0000 (09:30 -0400)
committerJunio C Hamano <redacted>
Fri, 2 Nov 2018 15:43:04 +0000 (00:43 +0900)
commitd1664e73ad96aa08735bf81d48ec0fb6d196cc3e
tree9c4339d85512d15000a398dafecbc77ab2b9d78a
parentd582ea202b626dcc6c3b01e1e11a296d9badd730
add: speed up cmd_add() by utilizing read_cache_preload()

During an "add", a call is made to run_diff_files() which calls
check_removed() for each index-entry.  The preload_index() code
distributes some of the costs across multiple threads.

Because the files checked are restricted to pathspec, adding
individual files makes no measurable impact but on a Windows repo
with ~200K files, 'git add .' drops from 6.3 seconds to 3.3 seconds
for a 47% savings.

Signed-off-by: Ben Peart <redacted>
Signed-off-by: Junio C Hamano <redacted>
builtin/add.c
git clone https://git.99rst.org/PROJECT