pidof and pgrep are slower than a grep /proc/[1-9]*/comm
Bastian Bittorf
bb at npl.de
Thu Sep 7 07:44:27 UTC 2023
On Wed, Sep 06, 2023 at 02:38:58AM +0200, Roberto A. Foglietta wrote:
> On Mon, 4 Sept 2023 at 21:52, Roberto A. Foglietta
> <roberto.foglietta at gmail.com> wrote:
> >
> > Just few facts:
> >
> > - moving from local var=$(command) to local var; car=$(commad)
> > - avoid to use pidof and pgrep but grep over /proc
> > - source instead of calling a script
> >
> > The script time to be ready for the user interaction drops from 1.7s
> > to 360ms.
>
> I have managed to replicate the two systems behaviours:
I understand your commands, but i do not understand
how you are measuring the time, see this:
root at slow-embedded:~ 8( time grep -E "command1|command2|command3"
/proc/[1-9]*/comm
Command exited with non-zero status 1
real 0m 0.00s
user 0m 0.00s
sys 0m 0.00s
It is so fast, how do you measure?
bye, Bastian
More information about the busybox
mailing list