From: Junio C Hamano Date: Tue, 22 May 2012 16:16:47 GMT Subject: Re: remove_duplicates() in builtin/fetch-pack.c is O(N^2) Message-ID: <7vwr445gy8.fsf@alter.siamese.dyndns.org> In-Reply-To: <20120521174525.GA22643@sigill.intra.peff.net> Jeff King writes: > I don't think there is any reason we can't sort the list of heads, and > then we can get rid of the duplicates with an O(n) traversal, like the > (largely untested) patch below. Yeah, I think the only case the order matters in fetch is the traditional "when multiple non-glob fetch refspecs are configured, only merge the first one" logic, but it kicks in a much higher layer and the order in this list should not have any effect on it. Thanks.