Bug#1021839: info -w is slow for man pages

2022-10-18 Thread Hilmar Preuße

Control: tags -1 + fixed-upstream

Am 15.10.2022 um 19:14 teilte Jakub Wilk mit:

Package: info
Version: 6.8-6

I noticed that "info -w" is puzzlingly slow when the argument is a man 
page:



This has been solved/implemented in two git commits:

commit ef2eb3589883dc6ced661e424f0e11bee05cc83b
Author: Gavin Smith 
Date:   Tue Oct 18 11:31:53 2022 +0100

* info/man.c (check_manpage_node):
Call get_manpage_node if exit status from man -w PAGE was 2.


commit 8520d2b4d80eebe49ed44f11c47901f87d35c29f
Author: Gavin Smith 
Date:   Sun Oct 16 14:21:32 2022 +0100

Check for man page with 'man -w'

* info/man.c (check_manpage_node): New function, to check if
man page exists with 'man -w'.  This is much faster for large
man pages.
(find_man_formatter): Cache return value.
* info/info.c (get_initial_file): Use check_manpage_node instead
of get_manpage_node.

'info -w ffmpeg-all' was reported to be slow by Hilmar Preusse.
'ffmpeg-all' is an especially long man page, so takes a longer time
for nroff to format.

Hilmar
--
sigfault



OpenPGP_signature
Description: OpenPGP digital signature


Bug#1021839: info -w is slow for man pages

2022-10-16 Thread Hilmar Preuße

Am 15.10.2022 um 19:14 teilte Jakub Wilk mit:

Hi Jakub,

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




I forwarded the issue to upstream [1], the main concern there is that 
"man -w" is not supported on all OS.



No, it doesn't exist on Solaris:

https://docs.oracle.com/cd/E26502_01/html/E29030/man-1.html#scrolltoc

It may be more trouble than it's worth to try to account for different
man versions.


Hilmar

[1] https://lists.gnu.org/archive/html/bug-texinfo/2022-10/msg00116.html
--
sigfault



OpenPGP_signature
Description: OpenPGP digital signature


Bug#1021839: info -w is slow for man pages

2022-10-15 Thread Jakub Wilk

Package: info
Version: 6.8-6

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


-- System Information:
Architecture: i386

Versions of packages info depends on:
ii  libc6 2.35-3
ii  libtinfo6 6.3+20220423-2
ii  install-info  6.8-6

--
Jakub Wilk