mirror of
https://github.com/git-for-windows/git.git
synced 2026-05-31 12:28:51 -05:00
path-walk: improve path-walk speed with many tags
In the presence of many tags, the use of oid_array_lookup() can become extremely slow. We should rely upon the SEEN bit instead. This affects the tag-peeling walk as well as the switch statement for adding the peeled object to the correct oid_array. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
c1267cca01
commit
084fec02a2
16
path-walk.c
16
path-walk.c
@@ -299,26 +299,28 @@ int walk_objects_by_path(struct path_walk_info *info)
|
|||||||
if (obj->type == OBJ_COMMIT || obj->flags & SEEN)
|
if (obj->type == OBJ_COMMIT || obj->flags & SEEN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
obj->flags |= SEEN;
|
|
||||||
|
|
||||||
while (obj->type == OBJ_TAG) {
|
while (obj->type == OBJ_TAG) {
|
||||||
struct tag *tag = lookup_tag(info->revs->repo,
|
struct tag *tag = lookup_tag(info->revs->repo,
|
||||||
&obj->oid);
|
&obj->oid);
|
||||||
if (oid_array_lookup(&tags, &obj->oid) < 0)
|
if (!(obj->flags & SEEN)) {
|
||||||
|
obj->flags |= SEEN;
|
||||||
oid_array_append(&tags, &obj->oid);
|
oid_array_append(&tags, &obj->oid);
|
||||||
|
}
|
||||||
obj = tag->tagged;
|
obj = tag->tagged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((obj->flags & SEEN))
|
||||||
|
continue;
|
||||||
|
obj->flags |= SEEN;
|
||||||
|
|
||||||
switch (obj->type) {
|
switch (obj->type) {
|
||||||
case OBJ_TREE:
|
case OBJ_TREE:
|
||||||
if (info->trees &&
|
if (info->trees)
|
||||||
oid_array_lookup(&root_tree_list->oids, &obj->oid) < 0)
|
|
||||||
oid_array_append(&root_tree_list->oids, &obj->oid);
|
oid_array_append(&root_tree_list->oids, &obj->oid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OBJ_BLOB:
|
case OBJ_BLOB:
|
||||||
if (info->blobs &&
|
if (info->blobs)
|
||||||
oid_array_lookup(&tagged_blob_list, &obj->oid) < 0)
|
|
||||||
oid_array_append(&tagged_blob_list, &obj->oid);
|
oid_array_append(&tagged_blob_list, &obj->oid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user