bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 5.1] zread: read files in 4k chunks


From: Jason A. Donenfeld
Subject: [PATCH 5.1] zread: read files in 4k chunks
Date: Sun, 21 Jun 2020 23:53:28 -0600

Currently a static sized buffer is used for reading files. At the moment
it is extremely small, making parsing of large files extremely slow.
Increase this to 4k for improved performance. This also allows reading
files like /dev/kmsg on Linux, which will error if the read buffer is
too small.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 lib/sh/zread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/sh/zread.c b/lib/sh/zread.c
index 8dd78102..f1389887 100644
--- a/lib/sh/zread.c
+++ b/lib/sh/zread.c
@@ -117,7 +117,7 @@ zreadintr (fd, buf, len)
    in read(2).  This does some local buffering to avoid many one-character
    calls to read(2), like those the `read' builtin performs. */
 
-static char lbuf[128];
+static char lbuf[4096];
 static size_t lind, lused;
 
 ssize_t
-- 
2.27.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]