Eli Zaretskii <e...@gnu.org> writes: >> From: Dirk Gouders <d...@gouders.net> >> Cc: Colin Watson <cjwat...@debian.org>, Eli Zaretskii <e...@gnu.org>, >> linux-...@vger.kernel.org, help-texi...@gnu.org, >> nabijaczlew...@nabijaczleweli.xyz, g.branden.robin...@gmail.com, >> groff@gnu.org >> Date: Sat, 08 Apr 2023 21:48:13 +0200 >> >> $ find /usr/share/man -type f -exec bzgrep -l RLIMIT_NOFILE {} \; >> /usr/share/man/man1/runuser.1.bz2 >> /usr/share/man/man1/su.1.bz2 >> /usr/share/man/man1/nghttpx.1.bz2 >> /usr/share/man/man3/getdtablesize.3.bz2 >> /usr/share/man/man3/mq_open.3.bz2 >> /usr/share/man/man3/errno.3.bz2 >> /usr/share/man/man3/sysconf.3.bz2 >> /usr/share/man/man3p/getrlimit.3p.bz2 >> /usr/share/man/man3p/sysconf.3p.bz2 >> /usr/share/man/man3p/posix_spawn_file_actions_addclose.3p.bz2 >> /usr/share/man/man0p/sys_resource.h.0p.bz2 >> /usr/share/man/man2/pidfd_open.2.bz2 >> /usr/share/man/man2/poll.2.bz2 >> /usr/share/man/man2/getrlimit.2.bz2 >> /usr/share/man/man2/open.2.bz2 >> /usr/share/man/man2/select.2.bz2 >> /usr/share/man/man2/fcntl.2.bz2 >> /usr/share/man/man2/seccomp_unotify.2.bz2 >> /usr/share/man/man2/dup.2.bz2 >> /usr/share/man/man2/pidfd_getfd.2.bz2 >> /usr/share/man/man7/fanotify.7.bz2 >> /usr/share/man/man7/capabilities.7.bz2 >> /usr/share/man/man7/unix.7.bz2 >> /usr/share/man/man5/proc.5.bz2 >> >> Yes, it's very slow but close to `man -K`: >> >> find... man -K... >> >> real 107.45 real 96.34 >> user 117.06 user 70.11 >> sys 14.43 sys 26.86 >> >> [a thought later] >> >> Oh, I found something much faster: >> >> $ time -p find /usr/share/man -type f | xargs bzgrep -l RLIMIT_NOFILE >> [snip] >> >> real 24.30 >> user 32.34 >> sys 6.84 >> >> Hmm, perhaps, someone has an explanation for this? > > Multiprocessing, obviously. Your CPU has more than one execution > unit, so the pipe via xargs runs 'find' and 'bzgrep' in parallel on > two different execution units. By contrast, "find -exec" runs them > sequentially, in a single thread.
Yes, that must be it, thanks. I noticed `man -K...` uses up to four CPUs in parallel and therefore was unsure. With your explanation, we can get even faster: $ time -p find /usr/share/man -type f | xargs -P 6 bzgrep -l RLIMIT_NOFILE [snip] real 7.56 user 32.97 sys 7.02 Dirk PS: Colin, too late, I noticed a Mail-Followup-To Header in your mail. For the future: Is it correct that in such a case one should use that recipient list (without your address) -- even if he replies to something you wrote? In that case: I'm sorry I did that wrong.