[comp.text] Speedup idea for troff/nroff

lmjm@doc.ic.ac.uk (Lee McLoughlin) (01/05/87)

This is a speedup idea for troff and its relatives that  I do not have
time to investigate but sounds pretty promising.

Most of the local use of troff is with a few standard packages (man,
ms, me).  Would it be possible to use the unexec routine to create a
preloaded version by running troff to read in the macro package
then unexecing itself out?  (Unexec is a routine which creates an
a.out equivalent to the current running program.)  GNU Emacs this 
approach to avoid the overhead of reloading its many lisp scripts.

Given the number of times that troff is run, the time taken to load
ms/me, and the infrequency of changes to these packages this does sound
like a winner.

It would be neatest if on calling troff it detects the use of the
macro package that has been ``wired-in'' in this way and execs the
unexeced version, so the users don't need to know about it.

I've only ever seen the GNU Emacs version of unexec but I but I
believe it was once posted on the net.

meissner@dg_rtp.UUCP (Michael Meissner) (01/06/87)

In article <387@ivax.doc.ic.ac.uk> lmjm@doc.ic.ac.uk (Lee McLoughlin) writes:
>
> Most of the local use of troff is with a few standard packages (man,
> ms, me).  Would it be possible to use the unexec routine to create a
> preloaded version by running troff to read in the macro package
> then unexecing itself out?  (Unexec is a routine which creates an
> a.out equivalent to the current running program.)  GNU Emacs this 
> approach to avoid the overhead of reloading its many lisp scripts.

    This is fixed in DWB's nroff (documenter's workbench, AT&T's repackaging of
nroff/troff).  Unfortunately, troff does not yet seem to have this option.
Instead of saying -m... to nroff, you say -c... to use a compacted macro (and
-k... to build a compacted macro).  The compacted macro is essentially an
area of memory written out, and read back in, much like unexec does.  I found
out about this when I used a slightly different version of nroff, then had
built the compacted table.  Needless to say, pointers to functions were off
by a few words, and it took several days to track down.  I wonder whether
release 2.0 of DWB (I only have access to 1.0 here) will allow -c and -k for
the device independent troff.
-- 
	Michael Meissner, Data General
	...mcnc!rti-sel!dg_rtp!meissner

mash@winchester.UUCP (John Mashey) (01/07/87)

In article <387@ivax.doc.ic.ac.uk> lmjm@doc.ic.ac.uk (Lee McLoughlin) writes:
>This is a speedup idea for troff and its relatives .....
>
>Most of the local use of troff is with a few standard packages (man,
>ms, me).  Would it be possible to use the unexec routine to create a
>preloaded version by running troff to read in the macro package
>then unexecing itself out?  (Unexec is a routine which creates an
>a.out equivalent to the current running program.)  ...

the nroff/troff of System V have done this for many years: one command
lets you create a file that has all of the necessary state information,
normally after the unchanging part of the macro package has been processed.
Then, invoking {n|t}roff -cx gets the "compressed" form of the macro package.
I think Fred Dalrymple did this [but somebody correct me if I'm wrong, it's been
a long time.]
-- 
-john mashey	DISCLAIMER: <generic disclaimer, I speak for me only, etc>
UUCP: 	{decvax,ucbvax,ihnp4}!decwrl!mips!mash, DDD:  	408-720-1700, x253
USPS: 	MIPS Computer Systems, 930 E. Arques, Sunnyvale, CA 94086

hlj@amdahl.UUCP (Hal Jespersen) (01/07/87)

In article <804@dg_rtp.UUCP> meissner@dg_rtp.UUCP (Michael Meissner) writes:
 >							I wonder whether
 >release 2.0 of DWB (I only have access to 1.0 here) will allow -c and -k for
 >the device independent troff.

Actually, DWB 2.0 removes both of the flags from nroff as well.  nroff is
now based on ditroff, rather than being a totally separate program.
-- 
				Hal Jespersen
				Amdahl Corp.
				Mailstop 316
				1250 E. Arques Ave.
				Sunnyvale, CA 94088-3470
				(408) 746-8288
				...{hplabs|ihnp4|seismo|decwrl}!amdahl!hlj

[The opinions expressed are those of the author and not necessarily
those of Amdahl Corporation, its management, or employees.]

gwyn@brl-smoke.ARPA (Doug Gwyn ) (01/07/87)

In article <387@ivax.doc.ic.ac.uk> lmjm@doc.ic.ac.uk (Lee McLoughlin) writes:
>...  Would it be possible to use the unexec routine to create a
>preloaded version by running troff to read in the macro package
>then unexecing itself out?  ...

This is essentially the approach used by "old troff" in AT&T
releases, under the name "compacted macros" (just the pre-compiled
macro data is saved, not the whole process).  New troff dropped
this (probably because BWK never had it in his version).

kg@elan.UUCP (Ken Greer) (01/08/87)

in article <804@dg_rtp.UUCP>, meissner@dg_rtp.UUCP (Michael Meissner) says:
> Xref: elan comp.unix.wizards:432 comp.text:131
> 
> In article <387@ivax.doc.ic.ac.uk> lmjm@doc.ic.ac.uk (Lee McLoughlin) writes:
>>
>> Would it be possible to use the unexec routine to create a
>> preloaded version by running troff to read in the macro package
> 
> This is fixed in DWB's nroff (documenter's workbench, AT&T's repackaging of
> nroff/troff).  Unfortunately, troff does not yet seem to have this option.
> I wonder whether release 2.0 of DWB will allow -c and -k for ditroff.

The compacted macros have been entirely removed from DWB 2.0.
(They never worked quite right.)  But if it's any help, 
both DWB 2.0 Nroff and Troff are TWICE AS FAST as the ones in DWB 1.0!
Most all tables, especially macro lookup tables are now hash coded. 
Our benchmarks show a performance improvement of a factor of 2 across
the board on all machines (from PCs to mainframes).  A big help
to those troff-hogged CPUs.
-- 
Ken Greer
ELAN Computer Group
(415) 948-8193
{hplabs,bnrmtv}!elan!kg

wcs@ho95e.UUCP (#Bill.Stewart) (01/12/87)

In article <94@winchester.UUCP> mash@winchester.UUCP (John Mashey) writes:
>In article <387@ivax.doc.ic.ac.uk> lmjm@doc.ic.ac.uk (Lee McLoughlin) writes:
>>This is a speedup idea for troff and its relatives .....
>>Most of the local use of troff is with a few standard packages (man,
>>ms, me).  Would it be possible to use the unexec routine to create a
>>preloaded version by running troff to read in the macro package
>>.....
>the nroff/troff of System V have done this for many years: one command
>lets you create a file that has all of the necessary state information,
>normally after the unchanging part of the macro package has been processed.
>Then, invoking {n|t}roff -cx gets the "compressed" form of the macro package.
>I think Fred Dalrymple did this [but somebody correct me if I'm wrong,

Someone else wrote that DWB 2.0 versions are twice as fast but don't
have this capability.  Another option, for monospaced output, is to use
sroff instead of nroff.  Sroff is signifcantly faster than nroff but
has a more limited macro capability.  There's a -mm package that does a
fairly complete emulation of the nroff -mm macros, but doesn't support
tbl or eqn.  Now that we have laser printers, I mostly use troff, but
sroff is useful on PCs with limited horsepower, and for previewing
documents on a terminal.
	Has anybody developed a -man macro package for sroff?
				Thanks;
-- 
# Bill Stewart, AT&T Bell Labs 2G-202, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs

montnaro@sprite.steinmetz (Skip Montanaro) (01/14/87)

In article <1257@ho95e.UUCP> wcs@ho95e.UUCP (Bill Stewart) writes:
>Someone else wrote that DWB 2.0 versions are twice as fast but don't
>have this capability.

That someone was Ken Greer from Elan Computer Group. At GE CRD we have
purchased Elan's DWB 2.0 offering in both PC and Sun UNIX flavors. Those who
do that sort of testing at CRD say that the speed of Elan's nroff on an
IBM-PC AT is quite good.

>Another option, for monospaced output, is to use sroff instead of nroff.

What is sroff? Is it part of DWB? If not, can it be obtained from some
well-known source?

[Standard Disclaimer: My opinions are my own. I have no affiliation with
Elan Compter Group other than as a customer.]

Skip Montanaro

ARPA: montanaro%desdemona.tcpip@ge-crd.arpa
UUCP: seismo!rochester!steinmetz!desdemona!montanaro
GE DECnet: csbvax::mrgate!montanaro@desdemona@smtp@tcpgateway
Skip Montanaro

ARPA: montanaro%desdemona.tcpip@ge-crd.arpa
UUCP: seismo!rochester!steinmetz!desdemona!montanaro
GE DECnet: csbvax::mrgate!montanaro@desdemona@smtp@tcpgateway

henry@utzoo.UUCP (Henry Spencer) (01/15/87)

> ... New troff dropped this (probably because BWK never had it in his
> version).

I have a dim recollection, which may be wrong, of one of the Research folks
saying "we dropped that because it was too hard to keep the precompiled
versions up to date with troff".

Also, my recollection is that you couldn't precompile just any macro package;
because of the odd way it was done, the package had to comply with some
non-trivial restrictions on the order of operations.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,decvax,pyramid}!utzoo!henry

hlj@amdahl.UUCP (Hal Jespersen) (01/23/87)

In article <1257@ho95e.UUCP> wcs@ho95e.UUCP (Bill Stewart 1-201-949-0705 ihnp4!ho95c!wcs HO 2G202) writes:
 >...  Another option, for monospaced output, is to use
 >sroff instead of nroff.

sroff has been removed from DWB 2.0.
-- 
				Hal Jespersen
				Amdahl Corp.
				Mailstop 316
				1250 E. Arques Ave.
				Sunnyvale, CA 94088-3470
				(408) 746-8288
				hlj@amdahl.amdahl.com  -or-
				...{hplabs|ihnp4|seismo|decwrl}!amdahl!hlj

[The opinions expressed are those of the author and not necessarily
those of Amdahl Corporation, its management, or employees.]