summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80077f0)
raw | patch | inline | side by side (parent: 80077f0)
author | Sergey Vlasov <vsu@altlinux.ru> | |
Wed, 21 Sep 2005 16:33:59 +0000 (20:33 +0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 23 Sep 2005 04:52:11 +0000 (21:52 -0700) |
The process() function is very often called multiple times for the
same object (because lots of trees refer to the same blobs), but did
not have a fast check for this, therefore a lot of useless calls to
has_sha1_file() and parse_object() were made before discovering that
nothing needs to be done.
This patch adds the SEEN flag which is used in process() to make it
look at each object only once. When testing git-local-fetch on the
repository of GIT, this gives a 14x improvement in CPU usage (mainly
because the redundant calls to parse_object() are now avoided -
parse_object() always unpacks and parses the object data, even if it
was already parsed before).
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
same object (because lots of trees refer to the same blobs), but did
not have a fast check for this, therefore a lot of useless calls to
has_sha1_file() and parse_object() were made before discovering that
nothing needs to be done.
This patch adds the SEEN flag which is used in process() to make it
look at each object only once. When testing git-local-fetch on the
repository of GIT, this gives a 14x improvement in CPU usage (mainly
because the redundant calls to parse_object() are now avoided -
parse_object() always unpacks and parses the object data, even if it
was already parsed before).
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
fetch.c | patch | blob | history |
index be3dc0a9f8a2cbe8d73dccf09a6d5940df8d4e58..bcdacaf77f403a56c8789e4a67d2899de1e445e1 100644 (file)
--- a/fetch.c
+++ b/fetch.c
#define TO_FETCH 2U
#define TO_SCAN 4U
#define SCANNED 8U
+#define SEEN 16U
static struct commit_list *complete = NULL;
static int process(struct object *obj)
{
+ if (obj->flags & SEEN)
+ return 0;
+ obj->flags |= SEEN;
+
if (has_sha1_file(obj->sha1)) {
parse_object(obj->sha1);
/* We already have it, so we should scan it now. */