Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: "Jason A. Donenfeld" Newsgroups: gnu.bash.bug Subject: [PATCH 5.1] zread: read files in 4k chunks Date: Sun, 21 Jun 2020 23:53:28 -0600 Lines: 28 Approved: bug-bash@gnu.org Message-ID: References: <20200622055328.155106-1-Jason@zx2c4.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1592805218 18115 209.51.188.17 (22 Jun 2020 05:53:38 GMT) X-Complaints-To: action@cs.stanford.edu Cc: "Jason A. Donenfeld" To: bug-bash@gnu.org, chet.ramey@case.edu Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; s=mail; bh=2TMcLHQSytEaJ+lSDMGCb/dc8sE=; b=Vr+VoblKsyS/UaIgOhzk m/8v8/hf1SvhE3XmI/Uyw95+H3J+Wy67l0a7S60aACo7RoujBb8Mr1OWrOGi2Jv5 rHcXkprU59+KfnA0A2ZoEUXpch+cKcfyY7UdtXcAUqAj7Jp0hQptt+HbHETAUbq0 UASaoHB/cmlm3O45BRmXKPrd/NLnNALgCobSUa/b1xkjpeZ4/3GCqF2PiV4MSmEo pOtV6vjElihYUTrMNrbMD1X2dpueg8RHwKTQki+DXhPHKqfMqxR2t9eTBAJwpiVz JGlFR2L4GCQ/e8gJOrph9XvTB/QxSGUzhFugw47waDUBt9dSXUjGPiIJ2eKUhqHB Sw== Received-SPF: pass client-ip=192.95.5.64; envelope-from=Jason@zx2c4.com; helo=mail.zx2c4.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/22 01:53:33 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20200622055328.155106-1-Jason@zx2c4.com> Xref: csiph.com gnu.bash.bug:16427 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 --- 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