From owner-svn-src-all@freebsd.org Fri Feb 21 21:53:27 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29F31244A13; Fri, 21 Feb 2020 21:53:27 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yw1-f66.google.com (mail-yw1-f66.google.com [209.85.161.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48PQFL67H8z4b2Z; Fri, 21 Feb 2020 21:53:26 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yw1-f66.google.com with SMTP id i190so1799520ywc.2; Fri, 21 Feb 2020 13:53:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sw8aM+bI4mchLyENi+lXWY9j98K82mYqpGJRS8ZEDiE=; b=j5lSw4tB47BzZw78sCQ02Nrg8YLWFPEjbtpkn5sA3VG58MZhB/8QdLTj/cu9dydFxH R9Y+x41cpV/65QX7sPFlTlz4RonYwmN6pgI3ZLAFC74n7VcgWJEpbrL7beOMHlDl68qk VTC72OkKObhbTmw04NWaw+O6AgkQL26ZrxmqLM8FoAH4oXkSVTXAtHJfcg71Z4I5eGMG NT2E40lFduswQL0yJcdporiwhnHwSFBzAOYDEuj8jwc8WKcjdaze7HS7p6ymmnY/bDrp 3xiM80mkPaP2OBfx1RzF0SRAjG0u/+xEyX+bC/+yobrJQl28O3MnNMd0ZC37ifxRFehW 6gtQ== X-Gm-Message-State: APjAAAXA8nqqEc8TCPX5aOGNTfMN2zE0HiZVQ1Eo4fZMdmsC/fZZ76O7 TTCIf54L/57Iz/zxSyBOY9yg6BKYahAlNHci6Gkd6w== X-Google-Smtp-Source: APXvYqx4/pePTIUaIfs+eFL98XOWR/IQtRTxxDDMOC4Wf8IxyBPFndvAEVeOmsI7NZk+qJeKWDuz31xVXyPmBB0Z8/Y= X-Received: by 2002:a0d:ce02:: with SMTP id q2mr31657135ywd.400.1582322004737; Fri, 21 Feb 2020 13:53:24 -0800 (PST) MIME-Version: 1.0 References: <202002200301.01K31RTk043426@repo.freebsd.org> In-Reply-To: From: Li-Wen Hsu Date: Sat, 22 Feb 2020 05:53:12 +0800 Message-ID: Subject: Re: svn commit: r358152 - head/bin/sh To: Antoine Brodin Cc: Hiroki Sato , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 48PQFL67H8z4b2Z X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Feb 2020 21:53:27 -0000 On Sat, Feb 22, 2020 at 4:58 AM Antoine Brodin wrote: > > On Thu, Feb 20, 2020 at 4:01 AM Hiroki Sato wrote: > > > > Author: hrs > > Date: Thu Feb 20 03:01:27 2020 > > New Revision: 358152 > > URL: https://svnweb.freebsd.org/changeset/base/358152 > > > > Log: > > Improve performance of "read" built-in command when using a seekable > > fd. > > > > The read built-in command calls read(2) with a 1-byte buffer because > > newline characters need to be detected even on a byte stream which > > comes from a non-seekable file descriptor. Because of this, the > > following script calls >6,000 read(2) to show a 6KiB file: > > > > while read IN; do echo "$IN"; done < /COPYRIGHT > > > > When the input byte stream is seekable, it is possible to read a data > > block and then reposition the file pointer to where a newline > > character found. This change adds a small buffer to do this and > > reduces the number of read(2) calls. > > > > Theoretically, multiple built-in commands reading the same seekable > > byte stream in a single pipe chain can share the buffer. However, > > this change just makes a single invocation of the read built-in > > allocate a buffer and deallocate it every time for simplicity. > > Although this causes read(2) to read the same regions multiple times, > > the performance penalty should be small compared to the reduction of > > read(2) calls. > > > > Reviewed by: jilles > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D23747 > > This seems to be broken on at least i386. > Please either fix or revert. > > Antoine (with hat: portmgr) Could you provide more detail? I'm worried because I didn't see related regression from the recent test results. We may need to add more test against the breakage you mentioned. Thanks, Li-Wen