Re: Accessibility of man pages

Alejandro Colomar
2023-04-08T21:53:47Z

[-- Attachment #1.1: Type: text/plain, Size: 3777 bytes --]

Hi Dirk, Ingo, Eli, Colin,

I prepared some (hopefully) fair comparison:

$ sudo make install-man prefix=/opt/local/man/compressed -j LINK_PAGES=symlink Z=.gz >/dev/null
$ sudo make install-man prefix=/opt/local/man/expanded__ -j LINK_PAGES=symlink >/dev/null

I don't know what kind of magic man(1) does to be so fast reading compressed pages:

$ export MANPATH=/opt/local/man/compressed/share/man
$ time man -Kaw RLIMIT_NOFILE | wc -l
17

real 0m0.330s
user 0m0.261s
sys 0m0.074s
$ time find $MANPATH -type f | xargs zgrep -l RLIMIT_NOFILE | wc -l
17

real 0m3.732s
user 0m4.776s
sys 0m0.703s
$ time find $MANPATH -type f | xargs -P0 zgrep -l RLIMIT_NOFILE | wc -l
17

real 0m3.403s
user 0m4.706s
sys 0m0.699s
$ time find $MANPATH -type f | while read f; do zcat $f | grep -l RLIMIT_NOFILE >/dev/null && echo "$f"; done | wc -l
17

real 0m3.730s
user 0m4.769s
sys 0m1.973s

man(1) seems to be faster than reading uncompressed pages! See:

$ export MANPATH=/opt/local/man/expanded__/share/man
$ time man -Kaw RLIMIT_NOFILE | wc -l
35

real 0m1.138s
user 0m0.669s
sys 0m0.470s
$ time find $MANPATH -type f | xargs grep -l RLIMIT_NOFILE | wc -l
17

real 0m0.018s
user 0m0.007s
sys 0m0.015s

Having the pages uncompressed seems to be an important advantage for
searching through the sources. 0.018 (with the manual search) is
more than 10x faster than what man(1) can get from compressed pages.
And it allows using more complex tools, like pcre2grep(1), or sed(1)
for more complex searches.

Colin, did I do anything wrong to have this slowness in man(1) with
uncompressed pages? Also, it's finding some repeated lines; did we
find a bug?

$ man -Kaw RLIMIT_NOFILE
/opt/local/man/expanded__/share/man/man3/errno.3
/opt/local/man/expanded__/share/man/man2/select.2
/opt/local/man/expanded__/share/man/man2/select.2
/opt/local/man/expanded__/share/man/man2/select.2
/opt/local/man/expanded__/share/man/man2/select.2
/opt/local/man/expanded__/share/man/man3/getdtablesize.3
/opt/local/man/expanded__/share/man/man3/mq_open.3
/opt/local/man/expanded__/share/man/man3/sysconf.3
/opt/local/man/expanded__/share/man/man2/fcntl.2
/opt/local/man/expanded__/share/man/man2/fcntl.2
/opt/local/man/expanded__/share/man/man2/open.2
/opt/local/man/expanded__/share/man/man2/open.2
/opt/local/man/expanded__/share/man/man2/open.2
/opt/local/man/expanded__/share/man/man2/poll.2
/opt/local/man/expanded__/share/man/man2/poll.2
/opt/local/man/expanded__/share/man/man2/seccomp_unotify.2
/opt/local/man/expanded__/share/man/man2/pidfd_getfd.2
/opt/local/man/expanded__/share/man/man2/dup.2
/opt/local/man/expanded__/share/man/man2/dup.2
/opt/local/man/expanded__/share/man/man2/dup.2
/opt/local/man/expanded__/share/man/man2/getrlimit.2
/opt/local/man/expanded__/share/man/man2/getrlimit.2
/opt/local/man/expanded__/share/man/man2/getrlimit.2
/opt/local/man/expanded__/share/man/man2/getrlimit.2
/opt/local/man/expanded__/share/man/man2/getrlimit.2
/opt/local/man/expanded__/share/man/man2/pidfd_open.2
/opt/local/man/expanded__/share/man/man2/select.2
/opt/local/man/expanded__/share/man/man2/select.2
/opt/local/man/expanded__/share/man/man2/select.2
/opt/local/man/expanded__/share/man/man2/select.2
/opt/local/man/expanded__/share/man/man5/proc.5
/opt/local/man/expanded__/share/man/man5/proc.5
/opt/local/man/expanded__/share/man/man7/capabilities.7
/opt/local/man/expanded__/share/man/man7/fanotify.7
/opt/local/man/expanded__/share/man/man7/unix.7

$ grep -n RLIMIT_NOFILE /opt/local/man/expanded__/share/man/man2/select.2
412:.B RLIMIT_NOFILE

Cheers,
Alex

--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]