]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Increase buffer size for IO operations.
authorMikhail Kolomeytsev <mkolom@yandex-team.ru>
Sat, 2 Apr 2016 19:54:01 +0000 (01:54 +0600)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 30 Jul 2016 13:24:16 +0000 (15:24 +0200)
https://lists.samba.org/archive/ccache/2016q2/001429.html

ccache.h
hash.c
util.c

index f0839b3d807551dc983b80dc88b98674aeb0280c..9194f233936d59ebbbd046f16eba1e57eb2c9c74 100644 (file)
--- a/ccache.h
+++ b/ccache.h
@@ -75,6 +75,9 @@ enum stats {
        (strlen(s) >= strlen(suffix) \
         && str_eq((s) + strlen(s) - strlen(suffix), (suffix)))
 
+/* buffer size for IO operations */
+#define READ_BUF_SZ (1<<18)
+
 // ----------------------------------------------------------------------------
 // args.c
 
diff --git a/hash.c b/hash.c
index 9cc2026c90c94358ec1b62ae5468d5a5535180cd..398a5d4062c62d25ef95b7b9f5eaa40cbacf8041 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -97,7 +97,7 @@ hash_int(struct mdfour *md, int x)
 bool
 hash_fd(struct mdfour *md, int fd)
 {
-       char buf[16384];
+       char buf[READ_BUF_SZ];
        ssize_t n;
 
        while ((n = read(fd, buf, sizeof(buf))) != 0) {
diff --git a/util.c b/util.c
index 6ef7ba7f58c352cd49d0bb0eee511f2248570888..acc43ab9d448dda5c4dc4c7c4c58ae434a521385 100644 (file)
--- a/util.c
+++ b/util.c
@@ -197,7 +197,7 @@ copy_fd(int fd_in, int fd_out)
        }
 
        int n;
-       char buf[10240];
+       char buf[READ_BUF_SZ];
        while ((n = gzread(gz_in, buf, sizeof(buf))) > 0) {
                ssize_t written = 0;
                do {
@@ -297,7 +297,7 @@ copy_file(const char *src, const char *dest, int compress_level)
        }
 
        int n;
-       char buf[10240];
+       char buf[READ_BUF_SZ];
        while ((n = gzread(gz_in, buf, sizeof(buf))) > 0) {
                int written;
                if (compress_level > 0) {