On Wed, 6 Sept 2023 at 02:38, Roberto A. Foglietta
<[email protected]> wrote:
>
> I did not verify the code yet. However, I think that it is necessary
> to introduce a test in the NOFORK code for which as long as busybox is
> running on a single CPU, it forks otherwise follow the default policy
> chosen at the building time.
A single test is NOT a statistic nor a benchmark, just an example of
what I am seeing:
redfishos:~ # taskset -pc $$
pid 25454's current affinity list: 0-3
redfishos:~ # a=$(date +%s%N); pidof yamui; b=$(date +%s%N); echo $((b-a))
766
102291042
We can set this number as reference 100% to compare the others
executions time in a relative way.
redfishos:~ # a=$(date +%s%N); grep -E "yamui$" /proc/[1-9]*/comm |
cut -d/ -f3; b=$(date +%s%N); echo $((b-a))
766
77236302
redfishos:~ # echo $((77236302 / 1022910))%
75%
redfishos:~ # a=$(date +%s%N); pgrep -x yamui; b=$(date +%s%N); echo $((b-a))
766
89810105
redfishos:~ # echo $((89810105 / 1022910))%
87%
Moreover the execution of this function (preloaded into the
environment) gives the same time consumption of the grep -E command
without any appreciable delay.
comm_pid() {
local i str
test -n "${1:-}" || return 1
for i in "$@"; do str="$i${str:+|$str}"; done
grep -E "$str" /proc/[1-9]*/comm | cut -d/ -f3
}
redfishos:~ # a=$(date +%s%N); comm_pid yamui$; b=$(date +%s%N); echo $((b-a))
766
76270209
redfishos:~ # echo $(( 76270209 / 1022910 ))%
74%
This means that not only two commands in the pipe are faster than an
applet but a simple function is faster than an applet. You can imagine
my surprise.
I hope this helps, R-
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox