]> git.ipfire.org Git - thirdparty/git.git/commit - tree-walk.c
do_compare_entry: use already-computed path
authorDavid Turner <dturner@twopensource.com>
Mon, 21 Dec 2015 22:34:20 +0000 (17:34 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 Jan 2016 21:39:46 +0000 (13:39 -0800)
commitd9c2bd560e1e7a3d4654fb6ef3f9037ad337eb01
tree04df29e0820e079bf4c90570b6e1adf39af5a1ac
parentf3adf457e046f92f039353762a78dcb3afb2cb13
do_compare_entry: use already-computed path

In traverse_trees, we generate the complete traverse path for a
traverse_info.  Later, in do_compare_entry, we used to go do a bunch
of work to compare the traverse_info to a cache_entry's name without
computing that path.  But since we already have that path, we don't
need to do all that work.  Instead, we can just put the generated
path into the traverse_info, and do the comparison more directly.

We copy the path because prune_traversal might mutate `base`. This
doesn't happen in any codepaths where do_compare_entry is called,
but it's better to be safe.

This makes git checkout much faster -- about 25% on Twitter's
monorepo.  Deeper directory trees are likely to benefit more than
shallower ones.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tree-walk.c
tree-walk.h
unpack-trees.c