bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: program gets faster when it outputs more on stderr


From: Mike Jonkmans
Subject: Re: program gets faster when it outputs more on stderr
Date: Thu, 7 Jun 2018 09:24:40 +0200

On Sat, Mar 10, 2018 at 04:50:22PM -0500, Chet Ramey wrote:
> On 3/10/18 9:46 AM, address@hidden 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 <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]