]> git.ipfire.org Git - thirdparty/git.git/commit - read-cache.c
read-cache: load cache extensions on a worker thread
authorBen Peart <benpeart@microsoft.com>
Wed, 10 Oct 2018 15:59:36 +0000 (11:59 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Oct 2018 06:32:48 +0000 (15:32 +0900)
commitabb4bb83845dc012ffe1c04750d1a09edd598a82
treea87abd9f2b64c27cd807bb574e73cd017bc1642c
parentc780b9cfe8d79331ed9797e328b1bf80666c4ac2
read-cache: load cache extensions on a worker thread

This patch helps address the CPU cost of loading the index by loading
the cache extensions on a worker thread in parallel with loading the cache
entries.

In some cases, loading the extensions takes longer than loading the
cache entries so this patch utilizes the new EOIE to start the thread to
load the extensions before loading all the cache entries in parallel.

This is possible because the current extensions don't access the cache
entries in the index_state structure so are OK that they don't all exist
yet.

The CACHE_EXT_TREE, CACHE_EXT_RESOLVE_UNDO, and CACHE_EXT_UNTRACKED
extensions don't even get a pointer to the index so don't have access to the
cache entries.

CACHE_EXT_LINK only uses the index_state to initialize the split index.
CACHE_EXT_FSMONITOR only uses the index_state to save the fsmonitor last
update and dirty flags.

I used p0002-read-cache.sh to generate some performance data:

Test w/100,000 files reduced the time by 0.53%
Test w/1,000,000 files reduced the time by 27.78%

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c