1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-11 20:15:03 -05:00

upload: change default UPLOAD_BUFSIZE to 64KB

To make uploads significantly faster in some circumstances.

Part 2 of #2888
Closes #2892
This commit is contained in:
Daniel Stenberg 2018-08-17 11:36:12 +02:00
parent e6e9b006f7
commit 8c80a9d1e2
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 8 additions and 3 deletions

View File

@ -992,7 +992,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
(data->set.crlf))) { (data->set.crlf))) {
/* Do we need to allocate a scratch buffer? */ /* Do we need to allocate a scratch buffer? */
if(!data->state.scratch) { if(!data->state.scratch) {
data->state.scratch = malloc(2 * data->set.buffer_size); data->state.scratch = malloc(2 * UPLOAD_BUFSIZE);
if(!data->state.scratch) { if(!data->state.scratch) {
failf(data, "Failed to alloc scratch buffer!"); failf(data, "Failed to alloc scratch buffer!");

View File

@ -143,8 +143,13 @@ typedef ssize_t (Curl_recv)(struct connectdata *conn, /* connection data */
#endif /* HAVE_LIBSSH2_H */ #endif /* HAVE_LIBSSH2_H */
/* The upload buffer size, should not be smaller than CURL_MAX_WRITE_SIZE, as /* 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 */ it needs to hold a full buffer as could be sent in a write callback.
#define UPLOAD_BUFSIZE CURL_MAX_WRITE_SIZE
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 */ /* The "master buffer" is for HTTP pipelining */
#define MASTERBUF_SIZE 16384 #define MASTERBUF_SIZE 16384