pidof and pgrep are slower than a grep /proc/[1-9]*/comm

Roberto A. Foglietta roberto.foglietta at gmail.com
Sun Sep 3 15:57:27 UTC 2023


Hi,

just for your information:

pidof $string
pgrep $string

are sensitively slower than this one

fgrep "$string" /proc/[1-9]*/comm | cut -d/ -f3

in particular when taskset -pc 0 $$ is used, but also in general.

I can accept that my system is the root cause of this issue. Moreover,
it is not the only anomaly that I have noticed.

f() { local pippo=$(command1) ; echo $pippo; }

is sensitively slower than

f() { local pippo; pippo=$(command1) ; echo $pippo; }

Best regards, R-


More information about the busybox mailing list