Skip to content

Commit

Permalink
Merge branch 'jk/mark-edges-uninteresting'
Browse files Browse the repository at this point in the history
Fix performance regression in v1.8.4.x and later.

* jk/mark-edges-uninteresting:
  list-objects: only look at cmdline trees with edge_hint
  t/perf: time rev-list with UNINTERESTING commits
  • Loading branch information
gitster committed Jan 27, 2014
2 parents e049109 + 200abe7 commit a6bec00
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
20 changes: 11 additions & 9 deletions list-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,17 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
}
mark_edge_parents_uninteresting(commit, revs, show_edge);
}
for (i = 0; i < revs->cmdline.nr; i++) {
struct object *obj = revs->cmdline.rev[i].item;
struct commit *commit = (struct commit *)obj;
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
continue;
mark_tree_uninteresting(commit->tree);
if (revs->edge_hint && !(obj->flags & SHOWN)) {
obj->flags |= SHOWN;
show_edge(commit);
if (revs->edge_hint) {
for (i = 0; i < revs->cmdline.nr; i++) {
struct object *obj = revs->cmdline.rev[i].item;
struct commit *commit = (struct commit *)obj;
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
continue;
mark_tree_uninteresting(commit->tree);
if (!(obj->flags & SHOWN)) {
obj->flags |= SHOWN;
show_edge(commit);
}
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions t/perf/p0001-rev-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,16 @@ test_perf 'rev-list --all --objects' '
git rev-list --all --objects >/dev/null
'

test_expect_success 'create new unreferenced commit' '
commit=$(git commit-tree HEAD^{tree} -p HEAD)
'

test_perf 'rev-list $commit --not --all' '
git rev-list $commit --not --all >/dev/null
'

test_perf 'rev-list --objects $commit --not --all' '
git rev-list --objects $commit --not --all >/dev/null
'

test_done

0 comments on commit a6bec00

Please sign in to comment.