From b8e098a057caa8cda588209499ff73260f7f819f Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Thu, 4 Jul 2024 11:14:05 +0200 Subject: [PATCH] transfer: avoid polling socket every transfer loop Improve download performance, minimal effort. Do not poll the socket for pending data every transfer loop iteration. This gives 10-20% performance gains on large HTTP/1.1 downloads (on my machine). Closes #14098 --- lib/transfer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/transfer.c b/lib/transfer.c index 4051f6743c..476f9c002e 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -336,7 +336,7 @@ static CURLcode readwrite_data(struct Curl_easy *data, if((k->keepon & KEEP_RECV_PAUSE) || !(k->keepon & KEEP_RECV)) break; - } while(maxloops-- && data_pending(data)); + } while(maxloops--); if((maxloops <= 0) || data_pending(data)) { /* did not read until EAGAIN or there is still pending data, mark as