@matheusbsbs / matheus-bagliano / commits / 066bf4c2e4
Fork 0

fetch-pack: use smaller handshake window for initial request

Start the initial request small by halving the INITIAL_FLUSH (we will try to stay one window ahead of the server, so we would end up giving twice as many "have" in flight at the very beginning). We may want to tweak these values even more, taking MTU into account. Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Shawn Pearce <spearce@spearce.org>

Junio C Hamano committed Mar 20, 2011 at 21:52 UTC 066bf4c2e43c7fb40405843e49f809431314865d
1 file changed +4 -2
builtin/fetch-pack.c
+4 -2
@@ -218,12 +218,14 @@ static void send_request(int fd, struct strbuf *buf)
218 safe_write(fd, buf->buf, buf->len);
219 }
220
221 -#define INITIAL_FLUSH 32
221 +#define INITIAL_FLUSH 16
222 #define LARGE_FLUSH 1024
223
224 static int next_flush(int count)
225 {
226 - if (count < LARGE_FLUSH)
226 + if (count < INITIAL_FLUSH * 2)
227 + count += INITIAL_FLUSH;
228 + else if (count < LARGE_FLUSH)
229 count <<= 1;
230 else
231 count += LARGE_FLUSH;