diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-04-24 12:03:08 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-04-24 12:34:15 +0200 |
commit | 0b8761186cbca201c643200090c6e67e7edc4073 (patch) | |
tree | f0d860ba02bafce2ee29e49dbc1f41015a1dd023 | |
parent | 7474418074f7c108f10fcbbf5e6e045484488dc9 (diff) | |
download | curl-0b8761186cbca201c643200090c6e67e7edc4073.tar.gz |
curl: set a 100K buffer size by default
Test command 'time curl http://localhost/80GB -so /dev/null' on a Debian
Linux.
Before (middle performing run out 9):
real 0m28.078s
user 0m11.240s
sys 0m12.876s
After (middle performing run out 9)
real 0m26.356s (93.9%)
user 0m5.324s (47.4%)
sys 0m8.368s (65.0%)
-rw-r--r-- | src/tool_operate.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c index 0e84ac398..724826c8e 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -246,6 +246,8 @@ static void setfiletime(long filetime, const char *filename, #endif /* defined(HAVE_UTIME) || \ (defined(WIN32) && (CURL_SIZEOF_CURL_OFF_T >= 8)) */ +#define BUFFER_SIZE (100*1024) + static CURLcode operate_do(struct GlobalConfig *global, struct OperationConfig *config) { @@ -888,10 +890,12 @@ static CURLcode operate_do(struct GlobalConfig *global, my_setopt(curl, CURLOPT_SEEKDATA, &input); my_setopt(curl, CURLOPT_SEEKFUNCTION, tool_seek_cb); - if(config->recvpersecond) - /* tell libcurl to use a smaller sized buffer as it allows us to - make better sleeps! 7.9.9 stuff! */ + if(config->recvpersecond && + (config->recvpersecond < BUFFER_SIZE)) + /* use a smaller sized buffer for better sleeps */ my_setopt(curl, CURLOPT_BUFFERSIZE, (long)config->recvpersecond); + else + my_setopt(curl, CURLOPT_BUFFERSIZE, (long)BUFFER_SIZE); /* size of uploaded file: */ if(uploadfilesize != -1) |