From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DCC47158090 for ; Mon, 2 May 2022 08:41:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 13001E0ABE; Mon, 2 May 2022 08:41:55 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D287EE0ABE for ; Mon, 2 May 2022 08:41:54 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C37F33414E1 for ; Mon, 2 May 2022 08:41:53 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1BFD32E1 for ; Mon, 2 May 2022 08:41:52 +0000 (UTC) From: "Lars Wendler" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Lars Wendler" Message-ID: <1651480903.d6d64f8fa58bae8d750bade521d5354507c9c483.polynomial-c@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/zsh/files/, app-shells/zsh/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-shells/zsh/files/zsh-5.8.1-performance_regression_fix.patch app-shells/zsh/zsh-5.8.1-r1.ebuild app-shells/zsh/zsh-5.8.1-r2.ebuild X-VCS-Directories: app-shells/zsh/files/ app-shells/zsh/ X-VCS-Committer: polynomial-c X-VCS-Committer-Name: Lars Wendler X-VCS-Revision: d6d64f8fa58bae8d750bade521d5354507c9c483 X-VCS-Branch: master Date: Mon, 2 May 2022 08:41:52 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: bf7eef35-979f-4192-bc68-843830299dbb X-Archives-Hash: 3b3d8df50d9573c5590250342c08aef9 commit: d6d64f8fa58bae8d750bade521d5354507c9c483 Author: Lars Wendler gentoo org> AuthorDate: Mon May 2 08:36:59 2022 +0000 Commit: Lars Wendler gentoo org> CommitDate: Mon May 2 08:41:43 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6d64f8f app-shells/zsh: Revbump to fix performance regression which was introduced with previous regression fix. Closes: https://bugs.gentoo.org/839900 Signed-off-by: Lars Wendler gentoo.org> .../zsh-5.8.1-performance_regression_fix.patch | 139 +++++++++++++++++++++ .../{zsh-5.8.1-r1.ebuild => zsh-5.8.1-r2.ebuild} | 1 + 2 files changed, 140 insertions(+) diff --git a/app-shells/zsh/files/zsh-5.8.1-performance_regression_fix.patch b/app-shells/zsh/files/zsh-5.8.1-performance_regression_fix.patch new file mode 100644 index 000000000000..14a3f38eb96d --- /dev/null +++ b/app-shells/zsh/files/zsh-5.8.1-performance_regression_fix.patch @@ -0,0 +1,139 @@ +From cbe8d2bcdc20682464217856aa48628804637f28 Mon Sep 17 00:00:00 2001 +From: Bart Schaefer +Date: Thu, 28 Apr 2022 21:06:51 -0700 +Subject: [PATCH] 50133: use read-ahead and lseek-rewind for efficient + line-buffered input + +--- + ChangeLog | 6 ++++++ + Src/input.c | 24 ++++++++++++++++++++- + configure.ac | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 88 insertions(+), 1 deletion(-) + +diff --git a/ChangeLog b/ChangeLog +index cae2fc4e3..79c77741b 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,9 @@ ++2022-04-28 Bart Schaefer ++ ++ * 50133 (Bart, PWS, Jun-ichi): Src/input.c, configure.ac: when ++ lseek(2) is available, use it to check for and rewind read-ahead ++ for more efficient line-buffered input. ++ + 2022-03-03 Peter Stephenson + + * 49792: Src/input.c, Test/A01grammar.ztst: Use line buffering +diff --git a/Src/input.c b/Src/input.c +index caa8e23b0..6cc1b8a51 100644 +--- a/Src/input.c ++++ b/Src/input.c +@@ -217,12 +217,34 @@ shinbufrestore(void) + static int + shingetchar(void) + { +- int nread; ++ int nread, rsize = isset(SHINSTDIN) ? 1 : SHINBUFSIZE; + + if (shinbufptr < shinbufendptr) + return STOUC(*shinbufptr++); + + shinbufreset(); ++#ifdef USE_LSEEK ++ if (rsize == 1 && lseek(SHIN, 0, SEEK_CUR) != (off_t)-1) ++ rsize = SHINBUFSIZE; ++ if (rsize > 1) { ++ do { ++ errno = 0; ++ nread = read(SHIN, shinbuffer, rsize); ++ } while (nread < 0 && errno == EINTR); ++ if (nread <= 0) ++ return -1; ++ if (isset(SHINSTDIN) && ++ (shinbufendptr = memchr(shinbuffer, '\n', nread))) { ++ shinbufendptr++; ++ rsize = (shinbufendptr - shinbuffer); ++ if (nread > rsize && ++ lseek(SHIN, -(nread - rsize), SEEK_CUR) < 0) ++ zerr("lseek(%d, %d): %e", SHIN, -(nread - rsize), errno); ++ } else ++ shinbufendptr = shinbuffer + nread; ++ return STOUC(*shinbufptr++); ++ } ++#endif + for (;;) { + errno = 0; + nread = read(SHIN, shinbufendptr, 1); +diff --git a/configure.ac b/configure.ac +index af8c5bba8..42f2837cd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2304,6 +2304,65 @@ if test x$zsh_cv_sys_fifo = xyes; then + AC_DEFINE(HAVE_FIFOS) + fi + ++dnl ----------- ++dnl check that lseek() correctly reports seekability. ++dnl ----------- ++AC_CACHE_CHECK(if lseek() correctly reports seekability, ++zsh_cv_sys_lseek, ++[AC_RUN_IFELSE([AC_LANG_SOURCE([[ ++#include ++#include ++#include ++#include ++#include ++#include ++int main() { ++ int pipefd[2], fd; ++ off_t ret; ++ char* tmpfile = "seekfiletest.tmp"; ++ if ((fd = open(tmpfile, O_CREAT, S_IRUSR)) < 0) { ++ fprintf(stderr, "creating file failed\n"); ++ return 1; ++ } ++ ret = lseek(fd, 0, SEEK_CUR); ++ close(fd); ++ unlink(tmpfile); ++ if (ret == (off_t)-1) { ++ fprintf(stderr, "lseek on regular file failed\n"); ++ return 1; ++ } ++ if (pipe(pipefd) < 0) { ++ fprintf(stderr, "creating pipe failed\n"); ++ return 1; ++ } ++ write(pipefd[1], "abcdefgh", 8); ++ ret = lseek(pipefd[0], 0, SEEK_CUR); ++ close(pipefd[0]); ++ close(pipefd[1]); ++ if (ret != (off_t)-1) { ++ fprintf(stderr, "lseek on pipe succeeded\n"); ++ return 1; ++ } ++ if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { ++ fprintf(stderr, "creating UNIX domain socket failed\n"); ++ return 1; ++ } ++ ret = lseek(fd, 0, SEEK_CUR); ++ close(fd); ++ if (ret != (off_t)-1) { ++ fprintf(stderr, "lseek on UNIX domain socket succeeded\n"); ++ return 1; ++ } ++ return 0; ++} ++]])],[zsh_cv_sys_lseek=yes],[zsh_cv_sys_lseek=no],[zsh_cv_sys_lseek=yes]) ++]) ++AH_TEMPLATE([USE_LSEEK], ++[Define to 1 if lseek() can be used for SHIN.]) ++if test x$zsh_cv_sys_lseek = xyes; then ++ AC_DEFINE(USE_LSEEK) ++fi ++ + dnl ----------- + dnl test for whether link() works + dnl for instance, BeOS R4.51 doesn't support hard links yet +-- +2.36.0 + diff --git a/app-shells/zsh/zsh-5.8.1-r1.ebuild b/app-shells/zsh/zsh-5.8.1-r2.ebuild similarity index 98% rename from app-shells/zsh/zsh-5.8.1-r1.ebuild rename to app-shells/zsh/zsh-5.8.1-r2.ebuild index 6cbf8622fe20..dbb80d5ae6d8 100644 --- a/app-shells/zsh/zsh-5.8.1-r1.ebuild +++ b/app-shells/zsh/zsh-5.8.1-r2.ebuild @@ -53,6 +53,7 @@ fi PATCHES=( "${FILESDIR}/${P}-non_interactive_shell_regression_fix.patch" + "${FILESDIR}/${P}-performance_regression_fix.patch" #839900 ) src_prepare() {