]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix icons loading speed.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 21 May 2016 15:52:02 +0000 (03:52 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 21 May 2016 15:52:02 +0000 (03:52 +1200)
Since trunk r14100 (Bug 3875: bad mimeLoadIconFile error handling), each
icon was read from disk and written to Store one character at a time. I
did not measure startup delays in production, but in debugging runs,
fixing this bug sped up icons loading from 1 minute to 4 seconds.

src/mime.cc

index 73211cc3dc67e6a23098f4a55f3770e2cf0c702b..a07564f802231a0a09eb6901b8b07cb7159cd6a8 100644 (file)
@@ -430,7 +430,7 @@ MimeIcon::created(StoreEntry *newEntry)
         /* read the file into the buffer and append it to store */
         int n;
         char *buf = (char *)memAllocate(MEM_4K_BUF);
-        while ((n = FD_READ_METHOD(fd, buf, sizeof(*buf))) > 0)
+        while ((n = FD_READ_METHOD(fd, buf, 4096)) > 0)
             e->append(buf, n);
 
         file_close(fd);