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


Groups > gnu.bash.bug > #14222

Re: program gets faster when it outputs more on stderr

From Mike Jonkmans <bashbug@jonkmans.nl>
Newsgroups gnu.bash.bug
Subject Re: program gets faster when it outputs more on stderr
Date 2018-06-07 09:24 +0200
Message-ID <mailman.1391.1528356310.1292.bug-bash@gnu.org> (permalink)
References <20180310144641.62962CC028D@sint.jonkmans.nl> <aa490cb0-7478-ac02-326c-5da78156135e@case.edu>

Show all headers | View raw


On Sat, Mar 10, 2018 at 04:50:22PM -0500, Chet Ramey wrote:
> On 3/10/18 9:46 AM, bashbug@jonkmans.nl wrote:
> 
> > Bash Version: 4.4
> > Patch Level: 12
> > Release Status: release
> > 
> > Description:
> > 	When a function is ran in a subshell environment (via backticks),
> > 	the program runs faster when that function also writes to stderr.
> 
> I don't get these results. I ran it a few times out of curiosity, and the
> `fast' version ran 2-3 times slower than the `slow' one. Even running it
> against a profiling version doesn't show any significant difference in
> function calls.
> 
> Your results could be due to many factors: stdio buffering, a scheduler
> that biases perceived interactive processes, I/O optimizations. Nothing
> to do with bash, though.
> 

When i run the script with realtime prio (as root) via : chrt -r 99 <script>
the timings are as expected; more output takes longer.

So it is likely the scheduler at work here.

I have rewritten my original script with namerefs to pass the result out of
the function. This saves a lot of fork/clone calls.
It seems to be fast enough to stay in the interactive scheduler regime.

Regards, Mike


PS Chet, i had already sent you this some time ago.
But accidentally not to the mailinglist.

--
Mike <bashbug@jonkmans.nl>

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


Thread

Re: program gets faster when it outputs more on stderr Mike Jonkmans <bashbug@jonkmans.nl> - 2018-06-07 09:24 +0200

csiph-web