tech-userlevel archive

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

Re: Possible slight speedup to non-interactive /bin/sh startup



    Date:        Mon, 11 Feb 2019 16:54:47 +0000
    From:        David Holland <dholland-tech%netbsd.org@localhost>
    Message-ID:  <20190211165447.GA12281%netbsd.org@localhost>

  | Maybe one of the necrocomputing folks wants to measure rc.d
  | performance with and without it :-)

Didn't test that before, but I have now ... well kind of have,
my rc.d on my test system does almost nothing ... but for it there
is no measurable difference in how long it takes to execute.

For a bunch of boots using a shell the old way ...

RC finished after 2 secs (2530987 usec)
RC finished after 2 secs (2553313 usec)
RC finished after 2 secs (2625678 usec)
RC finished after 2 secs (2484247 usec)
RC finished after 3 secs (2673188 usec)

For a bunch of boots using a shell the updated way (no linked in libedit)

RC finished after 2 secs (2506326 usec)
RC finished after 2 secs (2494100 usec)
RC finished after 2 secs (2759738 usec)
RC finished after 3 secs (2583906 usec)
RC finished after 2 secs (2599648 usec)

The "2" there is from $SECONDS but that's too crude to be useful,
so for this I added (just temporarily) a new $MICROSECONDS that
gives the elapsed execution (real) time of the shell (in microseconds...)

The two are roughly comparible (aside from the *100000) but only roughly,
SECONDS can be used to produce what date +%s gives, MICROSECONDS cannot
(easily) - the rounding isn't right.

The output is the very last thing that /etc/rc does before it exits,
the variations seem to depend more upon what the actual time of day is,
which can alter just how must work /etc/rc ends up doing - that explains
the 2759738 usec case I believe - I have seen others longer when the
boot happens right at an even multiple of 10 minutes past an hour, and
so cron has more to do, which slows everything else down a little.  I think.

Of course, for some uses, what is important is not the elapsed time,
but the power consumed, which is not necessarily related directly, and
is way beyond my abilities to (even attempt to) measure.

kre

ps: for fun, I made /rescue/sh be /bin/sh and with that ...

RC finished after 3 secs (2597822 usec)
RC finished after 3 secs (2540883 usec)
RC finished after 3 secs (2574320 usec)
RC finished after 3 secs (2807561 usec)
RC finished after 3 secs (2677099 usec)




Home | Main Index | Thread Index | Old Index