groff
[Top][All Lists]
Advanced

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

Re: [groff] [patch] do not strip mdoc macros


From: Ingo Schwarze
Subject: Re: [groff] [patch] do not strip mdoc macros
Date: Mon, 18 Mar 2019 08:37:32 +0100
User-agent: Mutt/1.8.0 (2017-02-23)

Hi Ralph,

Ralph Corderoy wrote on Sun, Mar 17, 2019 at 04:46:48PM +0000:

> If I had time, I'd use
> 
>     perf stat -e instructions troff -Tps -mbar foo.tr >foo.dit
>     
> for some sufficiently complex document and macro set, with and without
> stripping, to see if it could be measured.

I have no idea what "perf stat -e instructions" is supposed to mean -
perf(1) is "generate a perfect hash function from a key set" on my
system - but the effect is measurable without any tooling.

Given that i only sent a patch to stop stripping mdoc(7) in order
to keep the discussion focussed on one macro set at a time, i'm
only testing mdoc(7) for now.

One among the largest and most complicate mdoc(7) pages i'm aware of
is the ksh(1) manual:

   $ wc ksh.1
  5600   25263  134843 ksh.1

   $ time troff -mdoc -Tps ksh.1 > /dev/null      
    0m00.73s real     0m00.73s user     0m00.00s system
    0m00.73s real     0m00.72s user     0m00.01s system
    0m00.73s real     0m00.73s user     0m00.00s system
    0m00.72s real     0m00.71s user     0m00.01s system
    0m00.74s real     0m00.73s user     0m00.02s system
    0m00.74s real     0m00.73s user     0m00.01s system
    0m00.74s real     0m00.72s user     0m00.02s system
    0m00.75s real     0m00.72s user     0m00.03s system
    0m00.73s real     0m00.73s user     0m00.01s system
    0m00.74s real     0m00.73s user     0m00.01s system

Average: 0.735 +- 0.008

   $ time troff -mdoc_nostrip -Tps ksh.1 > /dev/null    
    0m00.76s real     0m00.76s user     0m00.00s system
    0m00.77s real     0m00.76s user     0m00.01s system
    0m00.76s real     0m00.75s user     0m00.02s system
    0m00.78s real     0m00.77s user     0m00.02s system
    0m00.77s real     0m00.77s user     0m00.00s system
    0m00.77s real     0m00.76s user     0m00.01s system
    0m00.76s real     0m00.75s user     0m00.01s system
    0m00.76s real     0m00.77s user     0m00.00s system
    0m00.75s real     0m00.75s user     0m00.01s system
    0m00.76s real     0m00.75s user     0m00.02s system

Average: 0.764 +- 0.008

Difference: 0.029 +- 0.012

So yes, the difference is measurable, but it's on the order of a
few percent, so it is practically irrelevant.  Using a different
output device yields similar results.

I don't doubt that it is possible to construct mdoc(7) input files
where the difference is larger, but that doesn't matter.  The mdoc(7)
language is only used for manual pages in practice, and pathological
edge cases do not occur in manual pages.  Besides, manual pages
tend to be small, ksh(1) is already quite unsual.

So, who is worried about a few milliseconds for an unusually large
manual page?

Yours,
  Ingo



reply via email to

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