Hi, On Sat, Aug 13, 2011 at 12:36:29AM +0200, Michael Haggerty wrote: > diff --git a/refs.c b/refs.c > index 8d1055d..f02cf94 100644 > --- a/refs.c > +++ b/refs.c ... > @@ -205,23 +208,28 @@ struct cached_refs *create_cached_refs(const char *submodule) > */ > static struct cached_refs *get_cached_refs(const char *submodule) > { > - if (! submodule) { > - if (!cached_refs) > - cached_refs = create_cached_refs(submodule); > - return cached_refs; > - } else { > - if (!submodule_refs) > - submodule_refs = create_cached_refs(submodule); > - else > - /* For now, don't reuse the refs cache for submodules. */ > - clear_cached_refs(submodule_refs); > - return submodule_refs; > + struct cached_refs *refs = cached_refs; > + if (! submodule) > + submodule = ""; Maybe instead of searching for the main refs store a pointer to them locally so you can immediately return here. That will keep the performance when requesting the main refs the same. If I see it correctly you are always prepending to the linked list and in case many submodules get cached this could slow down the iteration over the refs of the main repository. > + while (refs) { > + if (!strcmp(submodule, refs->name)) > + return refs; > + refs = refs->next; > } > + > + refs = create_cached_refs(submodule); > + refs->next = cached_refs; > + cached_refs = refs; > + return refs; > } ... Cheers Heiko -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html