On Sun, 10 Sept 2023 at 15:07, Roberto A. Foglietta
<[email protected]> wrote:

> Notice that the O(1, grep) vs O(N, pidof) is always present but to see
> a big difference N >> 1, like 8 or 10 for example. Using 2 for seeing
> the difference also works, but the difference can be more easily
> confused with some other source of lantencies. However, the O(1) vs
> O(N) is a fact that affects every system that relies on busybox pidof.
>

This is O(N) with N the number of parameters, 100 just to be sure that
time can do its job with 1/100s

pidof $(seq 1000 1100) | time cat
real    0m 9.57s

pidof $(seq 1000 1050) | time cat
real    0m 4.80s

pidof 1000 | time cat
real    0m 0.09s

This is O(1) clearly

comw_pid $(seq 1000 1100) | time cat
real    0m 0.12s

The system is running at 300MHz fixed frequency with 4 CPUs enabled
and 4 CPUs off-line.

taskset -pc $$
pid 1100's current affinity list: 0-3

We may wonder who is going to call pidof with 100 arguments but this
is another story.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to