From owner-svn-src-head@freebsd.org Fri Feb 21 20:58:48 2020 Return-Path: Delivered-To: svn-src-head@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 4B0242430E5; Fri, 21 Feb 2020 20:58:48 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) (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 48PP2G4F66z3MCZ; Fri, 21 Feb 2020 20:58:46 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qv1-f65.google.com with SMTP id n8so1577449qvg.11; Fri, 21 Feb 2020 12:58:46 -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=hwlfpptZf92f0ecdUrrIO45+QDFBBg8v6cJPmGt17wE=; b=edErqhEYZR7D5EJoRWGeSxL3MUj2OeEHfieQbeunNPbOesQ9luDREIWWxS7kO3JUgf OHNLN+FTucvBgUeWq7gHbRT+nfy55n+9QAMLkUATOsFmbTdlYek+ejCbRvkdsbfFZ4ZE mU9+58JSWRjo5UVeaFKKmhZik7KyM+spd7egPzrD3i/bFpLy2k1B+LcKLBBW4be1ujma NbFAloo4ovYxbKUrv1ArWbFrDC++jI1NnGLKQFmqfHMuNvuHlOZ8sWoyxuhRldHazykq PzQ1+edj18hBvwOZTPWkuJyEq5x3v+zPrFbGUSI6NqQKne3E4XjHBqYPR7by+j/svkJF 6NNQ== X-Gm-Message-State: APjAAAW2H0oGtwc1rA3Y+bMELtcCDI9uelPw/LIRzyQ1UhfAVr1Go+r3 0qTeZh2FDcTrTi2qT5AXh2GpSdUcvXdoZyltckaymOI6 X-Google-Smtp-Source: APXvYqwtJHgPKjAz3E0P7VKzo3l4h2m0pKRhl85OT5U3MCeCridBcVsaKC4AV6Rq+ycImpAnbPbc7zx1MzuxZUWrZtA= X-Received: by 2002:ad4:52eb:: with SMTP id p11mr30038438qvu.211.1582318724833; Fri, 21 Feb 2020 12:58:44 -0800 (PST) MIME-Version: 1.0 References: <202002200301.01K31RTk043426@repo.freebsd.org> In-Reply-To: <202002200301.01K31RTk043426@repo.freebsd.org> From: Antoine Brodin Date: Fri, 21 Feb 2020 21:58:33 +0100 Message-ID: Subject: Re: svn commit: r358152 - head/bin/sh To: Hiroki Sato Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 48PP2G4F66z3MCZ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of antoinebrodinfreebsd@gmail.com designates 209.85.219.65 as permitted sender) smtp.mailfrom=antoinebrodinfreebsd@gmail.com X-Spamd-Result: default: False [-2.94 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-0.94)[ipnet: 209.85.128.0/17(-2.99), asn: 15169(-1.67), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[65.219.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[65.219.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Feb 2020 20:58:48 -0000 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)