From: Jeff King <peff@peff.net>
To: Patrick Reynolds <patrick.reynolds@github.com>
Cc: Git <git@vger.kernel.org>
Subject: Re: [PATCH v2] use a hashmap to make remotes faster
Date: Tue, 29 Jul 2014 13:46:42 -0400 [thread overview]
Message-ID: <20140729174642.GB20042@peff.net> (raw)
In-Reply-To: <25222.0938886865-sendEmail@debian>
On Tue, Jul 29, 2014 at 02:43:39PM +0000, Patrick Reynolds wrote:
> Remotes are stored as an array, so looking one up or adding one without
> duplication is an O(n) operation. Reading an entire config file full of
> remotes is O(n^2) in the number of remotes. For a repository with tens of
> thousands of remotes, the running time can hit multiple minutes.
>
> Hash tables are way faster. So we add a hashmap from remote name to
> struct remote and use it for all lookups. The time to add a new remote to
> a repo that already has 50,000 remotes drops from ~2 minutes to < 1
> second.
>
> We retain the old array of remotes so iterators proceed in config-file
> order.
>
> Signed-off-by: Patrick Reynolds <patrick.reynolds@github.com>
As observers might have guessed, I already reviewed this off-list, but
to make it clear:
Reviewed-by: Jeff King <peff@peff.net>
-Peff
next prev parent reply other threads:[~2014-07-29 17:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 14:43 [PATCH v2] use a hashmap to make remotes faster Patrick Reynolds
2014-07-29 17:46 ` Jeff King [this message]
2014-07-30 18:26 ` Junio C Hamano
2014-09-05 9:55 ` Stefan Beller
2014-09-05 15:16 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140729174642.GB20042@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=patrick.reynolds@github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).