Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16427

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

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From "Jason A. Donenfeld" <Jason@zx2c4.com>
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 <mailman.248.1592805217.2574.bug-bash@gnu.org> (permalink)
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" <Jason@zx2c4.com>
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 <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <20200622055328.155106-1-Jason@zx2c4.com>
Xref csiph.com gnu.bash.bug:16427

Show key headers only | View raw


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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

[PATCH 5.1] zread: read files in 4k chunks "Jason A. Donenfeld" <Jason@zx2c4.com> - 2020-06-21 23:53 -0600

csiph-web