Skip to content

Commit

Permalink
cache-tree: trace regions for prime_cache_tree
Browse files Browse the repository at this point in the history
Commands such as "git reset --hard" rebuild the in-memory representation
of the cache tree index extension by parsing tree objects starting at a
known root tree. The performance of this operation can vary widely
depending on the width and depth of the repository's working directory
structure. Measure the time in this operation using trace2 regions in
prime_cache_tree().

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
derrickstolee authored and gitster committed Jan 16, 2021
1 parent 4c3e187 commit 0e5c950
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cache-tree.c
Expand Up @@ -744,10 +744,13 @@ void prime_cache_tree(struct repository *r,
struct index_state *istate,
struct tree *tree)
{
trace2_region_enter("cache-tree", "prime_cache_tree", the_repository);
cache_tree_free(&istate->cache_tree);
istate->cache_tree = cache_tree();

prime_cache_tree_rec(r, istate->cache_tree, tree);
istate->cache_changed |= CACHE_TREE_CHANGED;
trace2_region_leave("cache-tree", "prime_cache_tree", the_repository);
}

/*
Expand Down

0 comments on commit 0e5c950

Please sign in to comment.