From: Junio C Hamano Date: Thu, 07 Jan 2021 20:12:26 GMT Subject: Re: [PATCH v2 6/9] index-format: update preamble to cached tree extension Message-ID: In-Reply-To: <5a1a51c1-7ada-6f66-a6d0-2fc01303d334@gmail.com> Derrick Stolee writes: >> We later found out that we rather often compare the index against >> the tree of HEAD (think: "git status"), and diff-lib.c::diff_cache() >> does take advantage of the fact that an entire directory can be >> skipped if the tree object taken from the HEAD side exactly matches >> the tree recorded for the subdirectory in the cache tree extension. > > I need to read more about this. traverse_by_cache_tree() seems to > be a good place to start. Thanks. Ah, that one I forgot about. What I had in mind was a different optimization that is far more aggressive in unpack-trees.c::unpack_callback(); look for a comment that begins with "Everything under the name matches". The block allows us to skip an entire subdirectory hierarchy.