From: Alejandro Colomar <alx.manpages@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>,
"G. Branden Robinson" <g.branden.robinson@gmail.com>
Cc: dirk@gouders.net, cjwatson@debian.org, linux-man@vger.kernel.org,
help-texinfo@gnu.org, groff@gnu.org
Subject: Re: man page rendering speed (was: Playground pager lsp(1))
Date: Fri, 7 Apr 2023 21:04:03 +0200 [thread overview]
Message-ID: <f6ceff74-0c75-044c-6d12-756ac38c0738@gmail.com> (raw)
In-Reply-To: <83fs9bohog.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 4143 bytes --]
Hi!
On 4/7/23 17:06, Eli Zaretskii wrote:
>> Date: Fri, 7 Apr 2023 09:43:19 -0500
>> From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
>> Cc: alx.manpages@gmail.com, dirk@gouders.net, cjwatson@debian.org,
>> linux-man@vger.kernel.org, help-texinfo@gnu.org, groff@gnu.org
>>
>> ...which brings me to the other factor, of which I'm more confident: man
>> page rendering times are much lower than they were in Unix's early days.
>>
>> On my system, all groff man pages but one render in between a tenth and
>> a fortieth of a second. The really huge pages like groff(7),
>> groff_char(7), and groff_diff(7) are toward the upper end of this range,
>> because they are long, at ~20-25 U.S. letter pages when formatted for
>> PostScript or PDF, or have many large tables so the tbl(1) preprocessor
>> produces a lot of output.
>>
>> The outlier is groff_mdoc(7) at just over one-third of a second.
>
> Some people consider 0.1 sec, let alone 0.3 sec, to be long enough to
> be annoying.
>
> Also, did you try with libpng.3 or gcc.1?
$ time man -w gcc | xargs zcat | groff -man -Tutf8 2>/dev/null >/dev/null
real 0m0.406s
user 0m0.534s
sys 0m0.042s
But as others said, I don't really care about the time it takes to format
the entire document, but rather the first 24 lines, which is more like
instantaneous (per your own definition of ~0.5 s).
$ time man -w gcc | xargs zcat | groff -man -Tutf8 2>/dev/null | head -n24 >/dev/null
xargs: zcat: terminated by signal 13
real 0m0.064s
user 0m0.051s
sys 0m0.030s
As a curiosity, mandoc(1) seems to be faster for rendering the entire document, but slower to "start reading".
$ time man -w gcc | xargs zcat | mandoc >/dev/null
real 0m0.270s
user 0m0.218s
sys 0m0.057s
$ time man -w gcc | xargs zcat | mandoc | head -n24 >/dev/null
real 0m0.136s
user 0m0.119s
sys 0m0.023s
As a disclaimer, I do sometimes care about reading entire documents,
but even in that case, it's not so bad. I can read the few thousand man
pages in the Linux man-pages in about a few seconds, or a minute. [1]
>
>> Human subjects need a minimum of about 0.1 second of visual experience
>> or about .01 to .02 second of auditory experience to perceive
>> duration; any shorter experiences are called instantaneous.
>> -- Encyclopædia Britannica[2]
>
> IME, 0.05 sec of visual experiences is closer to reality.
This is the time to load the first 24 lines of almost any page.
gcc(1), which is one of the longest I have, takes 0.6 s. MAX(3),
which is one of the shortest I have, takes 0.4 s.
>
> Anyway, I won't argue.
Cheers,
Alex
[1]: Here's why I do care about time to lead entire pages. I know
I can optimize this pipeline by calling groff(1) directly, or even
better, mandoc(1), now that I know it's faster for entire docs,
but since I haven't used this function for a long time, I didn't
spend time optimizing it.
man_lsfunc()
{
if [ $# -lt 1 ]; then
>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
return $EX_USAGE;
fi
for arg in "$@"; do
man_section "$arg" 'SYNOPSIS';
done \
|sed_rm_ccomments \
|pcregrep -Mn '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]*?(...)?\s*\); *$' \
|grep '^[0-9]' \
|sed -E 's/syscall\(SYS_(\w*),?/\1(/' \
|sed -E 's/^[^(]+ \**(\w+)\(.*/\1/' \
|uniq;
}
man_section()
{
if [ $# -lt 2 ]; then
>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>...";
return $EX_USAGE;
fi
local page="$1";
shift;
local sect="$*";
find "$page" -type f \
|xargs wc -l \
|grep -v -e '\b1 ' -e '\btotal\b' \
|awk '{ print $2 }' \
|sort \
|while read -r manpage; do
(sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}' <"$manpage";
for s in $sect; do
<"$manpage" \
sed -n \
-e "/^\.SH $s/p" \
-e "/^\.SH $s/,/^\.SH/{/^\.SH/!p}";
done;) \
|man -P cat -l - 2>/dev/null;
done;
}
man_lsfunc() is quite slow, but it's acceptable to me, since I only
run it sporadically.
--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-04-07 19:04 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 20:37 Playground pager lsp(1) Dirk Gouders
2023-03-25 20:47 ` Dirk Gouders
2023-04-04 23:45 ` Alejandro Colomar
2023-04-05 5:35 ` Eli Zaretskii
2023-04-06 1:10 ` Alejandro Colomar
2023-04-06 8:11 ` Eli Zaretskii
2023-04-06 8:48 ` Gavin Smith
2023-04-07 22:01 ` Alejandro Colomar
2023-04-08 7:05 ` Eli Zaretskii
2023-04-08 13:02 ` Accessibility of man pages (was: Playground pager lsp(1)) Alejandro Colomar
2023-04-08 13:42 ` Eli Zaretskii
2023-04-08 16:06 ` Alejandro Colomar
2023-04-08 13:47 ` Colin Watson
2023-04-08 15:42 ` Alejandro Colomar
2023-04-08 19:48 ` Accessibility of man pages Dirk Gouders
2023-04-08 20:02 ` Eli Zaretskii
2023-04-08 20:46 ` Dirk Gouders
2023-04-08 21:53 ` Alejandro Colomar
2023-04-08 22:33 ` Alejandro Colomar
2023-04-09 10:28 ` Ralph Corderoy
2023-04-08 20:31 ` Ingo Schwarze
2023-04-08 20:59 ` Dirk Gouders
2023-04-08 22:39 ` Ingo Schwarze
2023-04-09 9:50 ` Dirk Gouders
2023-04-09 10:35 ` Dirk Gouders
[not found] ` <87a5zhwntt.fsf@ada>
2023-04-09 12:05 ` Compressed man pages (was: Accessibility of man pages (was: Playground pager lsp(1))) Alejandro Colomar
2023-04-09 12:17 ` Alejandro Colomar
2023-04-09 18:55 ` G. Branden Robinson
2023-04-09 12:29 ` Colin Watson
2023-04-09 13:36 ` Alejandro Colomar
2023-04-09 13:47 ` Compressed man pages Ralph Corderoy
2023-04-12 8:13 ` Compressed man pages (was: Accessibility of man pages (was: Playground pager lsp(1))) Sam James
2023-04-12 8:32 ` Compressed man pages Ralph Corderoy
2023-04-12 10:35 ` Mingye Wang
2023-04-12 10:55 ` Ralph Corderoy
2023-04-12 13:04 ` Compressed man pages (was: Accessibility of man pages (was: Playground pager lsp(1))) Kerin Millar
2023-04-12 14:24 ` Alejandro Colomar
2023-04-12 18:52 ` Mingye Wang
2023-04-12 20:23 ` Compressed man pages Alejandro Colomar
2023-04-13 10:09 ` Ralph Corderoy
2023-04-07 2:18 ` Playground pager lsp(1) G. Branden Robinson
2023-04-07 6:36 ` Eli Zaretskii
2023-04-07 11:03 ` Gavin Smith
2023-04-07 14:43 ` man page rendering speed (was: Playground pager lsp(1)) G. Branden Robinson
2023-04-07 15:06 ` Eli Zaretskii
2023-04-07 15:08 ` Larry McVoy
2023-04-07 17:07 ` man page rendering speed Ingo Schwarze
2023-04-07 19:04 ` Alejandro Colomar [this message]
2023-04-07 19:28 ` man page rendering speed (was: Playground pager lsp(1)) Gavin Smith
2023-04-07 20:43 ` Alejandro Colomar
2023-04-07 16:08 ` Colin Watson
2023-04-08 11:24 ` Ralph Corderoy
2023-04-07 21:26 ` reformatting man pages at SIGWINCH " Alejandro Colomar
2023-04-07 22:09 ` reformatting man pages at SIGWINCH Dirk Gouders
2023-04-07 22:16 ` Alejandro Colomar
2023-04-10 19:05 ` Dirk Gouders
2023-04-10 19:57 ` Alejandro Colomar
2023-04-10 20:24 ` G. Branden Robinson
2023-04-11 9:20 ` Ralph Corderoy
2023-04-11 9:39 ` Dirk Gouders
2023-04-17 6:23 ` G. Branden Robinson
2023-04-08 11:40 ` Ralph Corderoy
2023-04-05 10:02 ` Playground pager lsp(1) Dirk Gouders
2023-04-05 14:19 ` Arsen Arsenović
2023-04-05 18:01 ` Dirk Gouders
2023-04-05 19:07 ` Eli Zaretskii
2023-04-05 19:56 ` Dirk Gouders
2023-04-05 20:38 ` A less presumptive .info? (was: Re: Playground pager lsp(1)) Arsen Arsenović
2023-04-06 8:14 ` Eli Zaretskii
2023-04-06 8:56 ` Gavin Smith
2023-04-07 13:14 ` Arsen Arsenović
2023-04-06 1:31 ` Playground pager lsp(1) Alejandro Colomar
2023-04-06 6:01 ` Dirk Gouders
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6ceff74-0c75-044c-6d12-756ac38c0738@gmail.com \
--to=alx.manpages@gmail.com \
--cc=cjwatson@debian.org \
--cc=dirk@gouders.net \
--cc=eliz@gnu.org \
--cc=g.branden.robinson@gmail.com \
--cc=groff@gnu.org \
--cc=help-texinfo@gnu.org \
--cc=linux-man@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).