From 6afca450c3f2f05385900a7b8d3a0d47286f983f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 20 Mar 2011 21:52:44 -0700 Subject: [PATCH] fetch-pack: progressively use larger handshake windows The client has to dig the history deeper when more recent parts of its history do not have any overlap with the server it is fetching from. Make the handshake window exponentially larger as we dig deeper, with a reasonable upper cap. Signed-off-by: Junio C Hamano Acked-by: Shawn Pearce --- builtin/fetch-pack.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 1abe624dc..b4f34a2cf 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -219,10 +219,15 @@ static void send_request(int fd, struct strbuf *buf) } #define INITIAL_FLUSH 32 +#define LARGE_FLUSH 1024 static int next_flush(int count) { - return INITIAL_FLUSH + count; + if (count < LARGE_FLUSH) + count <<= 1; + else + count += LARGE_FLUSH; + return count; } static int find_common(int fd[2], unsigned char *result_sha1, -- 2.30.2