Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit a6bec00

Browse files
committed
Merge branch 'jk/mark-edges-uninteresting'
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
2 parents e049109 + 200abe7 commit a6bec00

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

list-objects.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,17 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
162162
}
163163
mark_edge_parents_uninteresting(commit, revs, show_edge);
164164
}
165-
for (i = 0; i < revs->cmdline.nr; i++) {
166-
struct object *obj = revs->cmdline.rev[i].item;
167-
struct commit *commit = (struct commit *)obj;
168-
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
169-
continue;
170-
mark_tree_uninteresting(commit->tree);
171-
if (revs->edge_hint && !(obj->flags & SHOWN)) {
172-
obj->flags |= SHOWN;
173-
show_edge(commit);
165+
if (revs->edge_hint) {
166+
for (i = 0; i < revs->cmdline.nr; i++) {
167+
struct object *obj = revs->cmdline.rev[i].item;
168+
struct commit *commit = (struct commit *)obj;
169+
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
170+
continue;
171+
mark_tree_uninteresting(commit->tree);
172+
if (!(obj->flags & SHOWN)) {
173+
obj->flags |= SHOWN;
174+
show_edge(commit);
175+
}
174176
}
175177
}
176178
}

t/perf/p0001-rev-list.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,16 @@ test_perf 'rev-list --all --objects' '
1414
git rev-list --all --objects >/dev/null
1515
'
1616

17+
test_expect_success 'create new unreferenced commit' '
18+
commit=$(git commit-tree HEAD^{tree} -p HEAD)
19+
'
20+
21+
test_perf 'rev-list $commit --not --all' '
22+
git rev-list $commit --not --all >/dev/null
23+
'
24+
25+
test_perf 'rev-list --objects $commit --not --all' '
26+
git rev-list --objects $commit --not --all >/dev/null
27+
'
28+
1729
test_done

0 commit comments

Comments
 (0)