[pdftex] TeX as a composition server?

Reinhard Kotucha reinhard.kotucha at web.de
Mon Oct 25 22:40:22 CEST 2010

On 25 October 2010 Peter Davis wrote:

 > On Mon, Oct 25, 2010 at 1:41 PM, Reinhard Kotucha
 > <reinhard.kotucha at web.de>wrote:
 > > On 25 October 2010 Peter Davis wrote:
 > >
 > >  > Ok, now I have a few days to prove that some flavor of TeX is
 > >  > equal to the task.  Specifically, I want to have TeX compose
 > >  > and output tens of thousands of pages (or copies of the same
 > >  > page).  I suppose the simplest thing would be some kind of
 > >  > look that just composes the same page of text over and over
 > >  > again, as many times as I want.
 > >
 > > Maybe I misunderstand, do you want to create documents where the
 > > content of all pages is exactly the same?
 > >
 > Basically, yes.  I just want to see how fast TeX can compose a few
 > tens of thousands of pages of text.  It could all be "Lorem ipsum
 > ..." or whatever.

Ok, then I misunderstood you indeed.  If one really needs thousands of
pages with the same content, one would certainly create only one page
and set references to it in the PDF file.  This way I can generate
43,000 pages per second on my machine, regardless of the complexity of
the page.  I had to redirect standard output to /dev/null, otherwise
it's slower by the factor of two.

For what you want to achieve I usually do the same as James proposed
already.  However, you have to do the test in \batchmode, on my
machine TeX needs 4 seconds to print the page numbers to screen (with
James' example).

I get some interesting results.  LaTeX needs 33 seconds while plain
TeX needs only 23 seconds (both with pdftex).  Can anybody explain?
The text doesn't contain any active characters or control sequences.
I never expected such a big difference.

When producing DVI, pdftex needs 11.5 seconds while Knuth's TeX needs
only 10 seconds.

pdflatex with font expansion and character protrusion takes a bit more
than a minute, I can't test it right now with plain TeX.

BTW, I would generate a file which can be \input by other files.  Then
one can compare different formats.

#! /usr/bin/env perl
my $n = 100000;
my $lorem = <<'TXT';
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.


open TEXT,">","lorem.tex";
for(1..$n) {
   print TEXT $lorem;
close TEXT

Then you can test it with different formats:


% Uncomment in order to create DVI:
%\ifx\pdfoutput\undefined\else\pdfoutput=0 \fi

\def\newpage{\par\vfill\eject} % allow \newpage in lorem.tex
\input lorem.tex


Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the pdftex mailing list