[tex-live] Making TeX run faster

Nelson H. F. Beebe beebe at math.utah.edu
Thu Mar 11 16:34:28 CET 2004


I rebuilt our TeX installations here on about a dozen flavors of Unix
earlier this week, making experiments with new compilers and compiler
optimizations.  In many cases, the optimized code failed the trip
and/or trap tests, but I ultimately got builds that did pass, and that
run faster than older versions.  Here is a snippet from the report
that I sent to our local TeX community:

>> ...
>> ===================
>> Timing improvements
>> ===================
>>
>> The motivation for the compiler experiments is to see if TeX can be
>> made to run faster on existing platforms.
>>
>> Using the average of 10 runs of typesetting the TeXbook (494 pages, 54
>> fonts), here are the page rates and speedups on our servers over the
>> previous versions of /usr/local/bin/tex (some of which were compiled
>> several years ago with less mature compilers), sorted from slowest to
>> fastest machine.
>>
>> =================================================================================
>>                          TeXbook typesetting (pages/sec)
>> Server          vendor          TeXLive         old     new     speedup (new:old)
>> =================================================================================
>> blab02            7.8           n/a               5.3     9.3   1.75
>> wombat            9.1             9.1            11.2    11.2   1.00
>> eilat           n/a              37              30      44     1.45
>> henry           n/a             n/a              44      76     1.73
>> mosso           n/a              66              47      77     1.64
>> suncore         n/a              79              85      99     1.16
>> uinta           129             114             145     146     1.00
>> fuji            n/a             219             240     249     1.04
>> ibapah          157             n/a             343     342     1.00
>> =================================================================================
>> ...

The TeXLive versions are 2003/9 for all but mosso (a DEC Alpha OSF/1
system), for which I used TeXLive 7.  Compared to vendor versions, I
got speedups up to 2.18 (ibapah, an Itanium-2 system).  Compared to
TeXLive, I got speedups of 1.14 to 1.28.  At our site, given our heavy
use of TeX, the speedups are very helpful.

The 343 pages/sec on the 1.4GHz Itanium-2 is fast, but is not the TeX
speed record; I have recorded 410 pages/sec on an Apple PowerMac G5
(2GHz PowerPC), 412 pages/sec on an 1.3GHz Pentium M Centrino, and 425
pages/sec on a 1.4GHz AMD Athlon.  The fastest Sun SPARC time so far
is 190 pages/sec on a 1.06GHz Sun Sun Blade 1500.  I should shortly
have access again to AMD Opteron systems, which may beat everything.

Alas, I never recorded speeds on the DEC-20/60 (TeX's original
development machine) and the VAX 8600; I estimate that they would have
run at about 0.5 page/sec and 2 pages/sec.

I think it would be worthwhile in preparation of the next TeXLive
release to make similar timing experiments, so that we can ship the
fastest TeX possible on each platform.

We should also document the compilation environment for every
supported binary distribution, to serve as a starting point for future
rebuilds.  To that end, here are the compilers and optimizations that
I used; there are more systems listed here than in the above table,
because for some, I had no previous builds to compare with.

==========================================================================================
Architecture			O/S			Compiler	CFLAGS
==========================================================================================
Apple PowerPC (PowerMac G3)	GNU/Linux (YD 2.3)	gcc-3.2.2	-O3 -g
Apple PowerPC (PowerMac G4)	MacOS 10.2.3		gcc-3.3.3	-O3 -g
DEC Alpha 21064 (EV4)		GNU/Linux (RH 6.2)	gcc-3.3		-O2 -mieee -g
DEC Alpha 21264	(EV5)		OSF/1 4.0		gcc-3.3.3	-O3 -mieee -mcpu=ev5 -g
Dell PowerEdge Intel Itanium-2	GNU/Linux (RH AS2.1)	icc-8.0		-O2
Intel Pentium III		GNU/Linux (RH 8)	gcc-3.3.3	-O4 -mcpu=i686 -march=i686 -g
Intel Pentium III		FreeBSD 5.0		gcc-3.3.2	-O3 -g
Intel Pentium III		NetBSD 1.6		gcc-3.3.2	-O3 -g
Intel Pentium III		OpenBSD 3.2		gcc-3.3.2	-O3 -g
Intel Pentium III		Solaris 9 x86		cc-5.5		-xO3 xdepend -dalign -xlibmil -xunroll=5 -xprefetch
SGI Origin/200 MIPS R10000	IRIX 6.5		gcc-3.3		-O3 -mips3 -g
Sun E5500 UltraSPARC II		Solaris 8		cc-5.3		-xO3 xdepend -dalign -xlibmil -xunroll=5 -xprefetch
Sun SPARC 10 (TI SuperSPARC 50)	GNU/Linux (RH 6.2)	gcc-3.3		-O3 -g
==========================================================================================

gcc beat vendor compilers on OSF/1 and IRIX systems, but Sun's
compilers beat gcc on Solaris (SPARC and x86), and Intel's icc beat
gcc on Itanium-2.  The BSD systems and the GNU/Linux systems on
non-Intel IA-32 hardware have only gcc available, although I used
locally-installed versions of gcc that are newer than /usr/bin/gcc.

Since TeXLive binaries have to run on a range of hardware within each
O/S, CPU-specific options like -mcpu=i686, -march=i686, -mcpu=ev5, and
-mips3 above cannot be used for TeXLive builds.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe at math.utah.edu  -
- 155 S 1400 E RM 233                       beebe at acm.org  beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
-------------------------------------------------------------------------------


More information about the tex-live mailing list