This is running in a barebones Ubuntu container on my MacBook as BSDs don't use /proc:
root@74c03a282fbe:/# ed
a
ls /proc/[0-9]/status | xargs -n 1 cat | awk '/^Name:/ { name = $2 } /^Pid:/ { pid = $2 } END { print "cmd: " name ", pid: " pid }'
.
w prc.sh
132
q
root@74c03a282fbe:/# chmod +x ./prc.sh
root@74c03a282fbe:/# hyperfine --warmup=100 "./prc.sh"
Benchmark 1: ./prc.sh
Time (mean ± σ): 2.2 ms ± 0.3 ms [User: 1.3 ms, System: 2.7 ms]
Range (min … max): 1.8 ms … 5.0 ms 880 runs
Warning: Command took less than 5 ms to complete. Results might be inaccurate.
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.