[tex-live] TeX Live 2004 final vs development: speed of TeX

Nelson H. F. Beebe beebe at math.utah.edu
Tue Nov 30 15:34:06 CET 2004

Tigran Aivazian <tigran at aivazian.fsnet.co.uk> asks about the speed of
TeX in the final TeX Live 2004 release.

The most likely cause of slowdown for TeX is excessive searching for
files.  Remember, TeX is just a filter: its processing time in most
cases is almost linear in the input size, and all of its activity,
except for file access, is in memory, and its memory footprint is
relatively small (a few MB) by today's standards.  Thus, it is
unlikely to be swapped out to disk during execution.

TeX is fast: on high-end Intel IA-32 systems, TeX typesets the TeXbook
at more than 670 pages/second (3.2GHz Xeon) --- less than a second for
a complex book is pretty amazing.

To record file access patterns of ANY program, not just TeX, the best
tool on Unix systems is a system-call tracer: strace on GNU/Linux,
truss on Solaris, ktrace on {Free,Net,Open}BSD, par on SGI IRIX, and
trace on ancient SunOS.  Here is a typical run on GNU/Linux:

	strace -f -o foo.log tex myfile.tex

Then search the log file for instances of file-related system calls:

	egrep 'open|access' foo.log

If your ls-R caches are out-of-date, or you are searching directory
trees (directories ending with // in a search path), then you may be
surprised at how many file-related system calls are being made.  In
particular, look at the ones that failed with ENOENT:

26514 access("./ls-R", R_OK)            = -1 ENOENT (No such file or directory)

If there are a lot of them, then path searching can probably be
optimized by updating the ls-R caches and adjusting search paths.

- 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