Re: Accessibility of man pages

Ingo Schwarze
2023-04-08T20:31:36Z

Hi Dirk,

Dirk Gouders wrote on Sat, Apr 08, 2023 at 09:48:13PM +0200:

> 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?

These are all terribly slow IMHO.

For comparison, this happens on my OpenBSD notebook, with more than
five hundred optional software packages installed in addition to the
complete default installation:

$ time man -k any=RLIMIT_NOFILE
dup, dup2, dup3(2) - duplicate an existing file descriptor
getrlimit, setrlimit(2) - control maximum system resource consumption
sudoers(5) - default sudo security policy plugin
0m00.21s real 0m00.00s user 0m00.03s system

$ time man -k 'any=rlimit'
ps(1) - display process status
brk, sbrk(2) - change data segment size
dup, dup2, dup3(2) - duplicate an existing file descriptor
execve(2) - execute a file
fork(2) - create a new process
getdtablecount(2) - get descriptor table count
getrlimit, setrlimit(2) - control maximum system resource consumption
mlock, munlock(2) - lock (unlock) physical pages in memory
mlockall, munlockall(2) - lock (unlock) the address space of a process
pledge(2) - restrict system operations
poll, ppoll(2) - synchronous I/O multiplexing
quotactl(2) - manipulate filesystem quotas
sigaction(2) - software signal facilities
getdtablesize(3) - get descriptor table size
login_cap, login_getclass, login_close, login_getcapbool, login_getcapnum, login_getcapsize, login_getcapstr, login_getcaptime, login_getstyle, setclasscontext, setusercontext(3) - query login.conf database about a user class
signal, bsd_signal(3) - simplified software signal facilities
sigvec(3) - software signal facilities
core(5) - memory image file format
login.conf(5) - login class capability database
sudoers(5) - default sudo security policy plugin
fork1(9) - create a new process
mi_switch, cpu_switchto(9) - switch to another process context
0m00.05s real 0m00.01s user 0m00.00s system

$ time man -k any=RLIMIT_NOFILE
dup, dup2, dup3(2) - duplicate an existing file descriptor
getrlimit, setrlimit(2) - control maximum system resource consumption
sudoers(5) - default sudo security policy plugin
0m00.01s real 0m00.01s user 0m00.01s system

The effect that the time goes down from 210 milliseconds to 10
milliseconds when doing the search a second time is due to the fact
that the kernel now has the required information in the buffer cache
and no longer needs to read from the rotating disk. The machine in
question has i5 2.3 GHz processors and 8 GB of RAM, so it's hardly
a high-end machine.

Yours,
Ingo