]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
upload: change default UPLOAD_BUFSIZE to 64KB
authorDaniel Stenberg <daniel@haxx.se>
Fri, 17 Aug 2018 09:36:12 +0000 (11:36 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 18 Aug 2018 13:48:52 +0000 (15:48 +0200)
To make uploads significantly faster in some circumstances.

Part 2 of #2888
Closes #2892

lib/transfer.c
lib/urldata.h

index 96d8ab48fbc22bbf91c85e05be188576dff5e04e..ab9094adc0698b65bbf1baaf264d8d01615398dc 100644 (file)
@@ -992,7 +992,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
          (data->set.crlf))) {
         /* Do we need to allocate a scratch buffer? */
         if(!data->state.scratch) {
-          data->state.scratch = malloc(2 * data->set.buffer_size);
+          data->state.scratch = malloc(2 * UPLOAD_BUFSIZE);
           if(!data->state.scratch) {
             failf(data, "Failed to alloc scratch buffer!");
 
index 502cff36253e5b5157be6dfe6290030f70eb7498..67db3b2fcac01b8cdac5e2fa513a636a4e6c5037 100644 (file)
@@ -143,8 +143,13 @@ typedef ssize_t (Curl_recv)(struct connectdata *conn, /* connection data */
 #endif /* HAVE_LIBSSH2_H */
 
 /* The upload buffer size, should not be smaller than CURL_MAX_WRITE_SIZE, as
-   it needs to hold a full buffer as could be sent in a write callback */
-#define UPLOAD_BUFSIZE CURL_MAX_WRITE_SIZE
+   it needs to hold a full buffer as could be sent in a write callback.
+
+   The size was 16KB for many years but was bumped to 64KB because it makes
+   libcurl able to do significantly faster uploads in some circumstances. Even
+   larger buffers can help further, but this is deemed a fair memory/speed
+   compromise. */
+#define UPLOAD_BUFSIZE 65536
 
 /* The "master buffer" is for HTTP pipelining */
 #define MASTERBUF_SIZE 16384