git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] fetch-pack: progressively use larger handshake windows

From
Junio C Hamano <junio@pobox.com>
Date
Mar 18, 2011, 22:27 UTC
Message-ID
<7vzkosrrms.fsf@alter.siamese.dyndns.org>

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 <gitster@pobox.com>
---
 * This uses rather simpleminded "double up to the limit".
 builtin/fetch-pack.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 20e30f5..b4f34a2 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,
Message 1 of 1 in “fetch-pack: progressively use larger handshake windows”
  1. 2/3 fetch-pack: progressively use larger handshake windowsJunio C Hamano, Mar 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.