help-texinfo
[Top][All Lists]
Advanced

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

Re: man page rendering speed (was: Playground pager lsp(1))


From: Alejandro Colomar
Subject: Re: man page rendering speed (was: Playground pager lsp(1))
Date: Fri, 7 Apr 2023 22:43:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1

Hi Gavin,

On 4/7/23 21:28, Gavin Smith wrote:
> On Fri, Apr 07, 2023 at 09:04:03PM +0200, Alejandro Colomar wrote:
>> $ 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).
> 
> Here's a sample comparison of "man" versus "info" on my system
> (relevant as help-texinfo@gnu.org is being copied into this
> discussion):
> 
> $ time info gcc > temp
> 
> real    0m0.112s
> user    0m0.085s
> sys     0m0.017s
> $ ls -l temp
> -rw-rw-r-- 1 g g 3.0M Apr  7 20:14 temp
> $ time man gcc > temp
> troff: <standard input>:11612: warning [p 111, 6.0i]: can't break line
> troff: <standard input>:11660: warning [p 111, 13.8i]: can't break line
> 
> real    0m0.620s
> user    0m1.004s
> sys     0m0.114s
> $ ls -l temp
> -rw-rw-r-- 1 g g 1.2M Apr  7 20:16 temp
> 
> I find the startup of "info" to be instantaneous, whereas man pages often
> have a noticeable delay.

The times you showed are not _startup_ times, but rather the time for
formatting the _entire_ documents.  Remember that less(1) already shows you
the first lines when they are ready, without waiting for the rest of the
pipe.

I've optimized a moment ago the functions I had for listing all the
functions that appear in the Linux man-pages' SYNOPSIS sections, and got it
down from 55 s (calling man(1)) to just 14 s (calling groff(1)) and further
to 4 s (calling mandoc(1)).

That's parsing around a thousand pages, extracting the SYNOPSIS with sed(1),
formatting it, and parsing that to find function prototypes.

I guess that's one of the worst cases of when one would care about the time
it takes to format a man page, and it's a very reasonable one.


> 
> Doubtless man would have more comparable runtimes were cat pages being used.

The startup times don't really change.  It's around 0.5 s.  However, the
time to show the entire page is the same (i.e., virtually all the time is
spent in finding and opening the page)

> 
> Being able to reformat the text for arbitrary widths is of limited use,
> in my opinion, as text becomes more unreadable at long line lengths.

I often want it for the opposite reason: I want to make the terminal
narrower (e.g., for pasting contents into an email, at 72 or 66 columns).

>  I
> suppose cat pages could be provided in a series of sensible widths.  (The
> same is true in theory for Info, but I've never heard of anybody using
> widths for Info output other than the default 72 columns.)

Cheers,
Alex

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

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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