Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Simon J. Gerraty
Just caught the tail of this thread so sorry for chiming in from the peanut gallery... blah | while read x; do ...; done behaves very differently to the for loop variant in that the body of the loop runs in a sub-shell and thus cannot affect the outer scope. In many cases that's exactly

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Conrad Meyer
On Tue, Dec 11, 2018 at 2:42 PM Devin Teske wrote: > In that case, would it be appropriate to say that: > > blah | while read x; do ...; done > > Is always more efficiently written as: > > IFS=$'\n' > for x in $( blah ); do ...; done I don't know. The suggestion came

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Devin Teske
> On Dec 11, 2018, at 1:54 PM, Conrad Meyer wrote: > > On Tue, Dec 11, 2018 at 12:35 PM Devin Teske wrote: >>> On Dec 11, 2018, at 11:57 AM, Conrad Meyer wrote: >>> Is there any interest in a tee(2)-like syscall? >>> >> >> Linux has vmsplice(2). I know jmg@ also expressed interest in

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Conrad Meyer
On Tue, Dec 11, 2018 at 12:35 PM Devin Teske wrote: > > On Dec 11, 2018, at 11:57 AM, Conrad Meyer wrote: > > Is there any interest in a tee(2)-like syscall? > > > > Linux has vmsplice(2). I know jmg@ also expressed interest in having a > vmsplice in FreeBSD. Sure; they're related. See also

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Poul-Henning Kamp
In message <20181212071210.l...@besplex.bde.org>, Bruce Evans writes: >But software bloat is now outrunning CPU speed increases. Some bandwidths >for reading 1 byte at a time run today on the same 2GHz CPU i386 UP hardware > >linux-2.1.128 kernel built in 1998: 2500k/sec >linux-2.4.0t8

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Bruce Evans
On Tue, 11 Dec 2018, John Baldwin wrote: On 12/11/18 9:40 AM, Devin Teske wrote: ... Thank you for the background which was lost by the time I got to the phab. I can't help but ask though,... If it was noticed that read(2) processes the stream one byte at a time, why not just optimize

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Devin Teske
> On Dec 11, 2018, at 11:57 AM, Conrad Meyer wrote: > > On Tue, Dec 11, 2018 at 10:04 AM Warner Losh wrote: >> On Tue, Dec 11, 2018, 9:55 AM John Baldwin >> >>> The 'read' builtin in sh can't use buffering, so it is always going to be >>> slow >> >> It can't use it because of pipes. The

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Conrad Meyer
On Tue, Dec 11, 2018 at 10:04 AM Warner Losh wrote: > On Tue, Dec 11, 2018, 9:55 AM John Baldwin > >> The 'read' builtin in sh can't use buffering, so it is always going to be >> slow > > It can't use it because of pipes. The example from the parts of this that was > on IRC was basically: > >

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Conrad Meyer
On Tue, Dec 11, 2018 at 9:24 AM John Baldwin wrote: > list_vars is rarely used outside of > 'netif', so it probably doesn't make a measurable difference on bare metal. To clarify: It likely doesn't make a measurable difference *to boot times* on bare metal, but even on amd64 bare metal the time

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Warner Losh
On Tue, Dec 11, 2018, 9:55 AM John Baldwin The 'read' builtin in sh can't use buffering, so it is always going to be > slow > It can't use it because of pipes. The example from the parts of this that was on IRC was basically: foo | (read bar; baz) Which reads one line into the bar variable and

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread John Baldwin
On 12/11/18 9:40 AM, Devin Teske wrote: > > >> On Dec 11, 2018, at 9:23 AM, John Baldwin > > wrote: >> >> On 12/10/18 5:38 PM, Conrad Meyer wrote: >>> Author: cem >>> Date: Tue Dec 11 01:38:50 2018 >>> New Revision: 341803 >>> URL:

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread Devin Teske
> On Dec 11, 2018, at 9:23 AM, John Baldwin wrote: > > On 12/10/18 5:38 PM, Conrad Meyer wrote: >> Author: cem >> Date: Tue Dec 11 01:38:50 2018 >> New Revision: 341803 >> URL: https://svnweb.freebsd.org/changeset/base/341803 >> >> Log: >> rc.subr: Implement list_vars without using 'read'

Re: svn commit: r341803 - head/libexec/rc

2018-12-11 Thread John Baldwin
On 12/10/18 5:38 PM, Conrad Meyer wrote: > Author: cem > Date: Tue Dec 11 01:38:50 2018 > New Revision: 341803 > URL: https://svnweb.freebsd.org/changeset/base/341803 > > Log: > rc.subr: Implement list_vars without using 'read' > > 'read' pessimistically read(2)s one byte at a time, which

svn commit: r341803 - head/libexec/rc

2018-12-10 Thread Conrad Meyer
Author: cem Date: Tue Dec 11 01:38:50 2018 New Revision: 341803 URL: https://svnweb.freebsd.org/changeset/base/341803 Log: rc.subr: Implement list_vars without using 'read' 'read' pessimistically read(2)s one byte at a time, which can be quite silly for large environments in slow