[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: info -w is slow for man pages

From: Gavin Smith
Subject: Re: info -w is slow for man pages
Date: Sun, 16 Oct 2022 14:23:27 +0100

On Sat, Oct 15, 2022 at 11:58:53PM +0200, Hilmar Preusse wrote:
> Dear developers,
> I noticed that "info -w" is puzzlingly slow when the argument is a man page:
>     $ time -p info -w ffmpeg-all
>     *manpages*
>     real 1.06
>     user 1.47
>     sys 0.16
> In contrast, "man -w" is near-instantaneous:
>     $ time -p man -w ffmpeg-all
>     /usr/share/man/man1/ffmpeg-all.1.gz
>     real 0.05
>     user 0.04
>     sys 0.01
> Apparently this is because "info -w" calls "man -a", which is a very 
> inefficent way to check if a man page exists:
>     $ strace -f -e trace=execve -o '| grep -w man >&2' info -w ffmpeg-all > 
> /dev/null
>     1142  execve("/usr/bin/man", ["/usr/bin/man", "-a", "ffmpeg-all"], 
> 0xfffd7dd4 /* 52 vars */) = 0

Both "man ffmpeg-all" and "man -a ffmpeg-all" are slow.  "man ffmpeg-all" 
on the command line shows the manual in about 0.1 sec but the
underlying troff formatter is still running, as you can tell if you
immediately press End to go to the end of the man page - there is a
delay while the formatting finishes.

The execution time is apparent because "ffmpeg-all" is a longer man page.

Info is getting the whole page to check if the man page exists.

I've committed more code to use "man -w" first to check if the man page
exists, before "man -a", in commit 8520d2b4d8.

However, there is the risk that this breaks on some system where "man"
works differently to mine.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]