fetch: Speed up fetch by rewriting find_non_local_tags
authorJulian Phillips <julian@quantumfyre.co.uk>
Thu, 17 Sep 2009 07:33:19 +0000 (08:33 +0100)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 29 Sep 2009 17:06:50 +0000 (10:06 -0700)
commit3d0ff8f8ab15bd7d8f4d51cdd6affc288349af87
tree60c445fbaeddd0cbb6fbc2add7557498b03424c1
parent1be224ba6e99f0ab34c998d7fa8023b76a15c8b6
fetch: Speed up fetch by rewriting find_non_local_tags

When trying to get a list of remote tags to see if we need to fetch
any we were doing a linear search for the matching tag ref for the
tag^{} commit entries.  This proves to be incredibly slow for large
numbers of tags.  Rewrite the function so that we build up a
string_list of refs to fetch and then process that instead.

As an extreme example, for a repository with 50000 tags (and just a
single commit on a single branch), a fetch that does nothing goes from
~1m50s to ~4.1s.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-fetch.c