TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The most obvious way to speed up LaTeX processing is to split a large and complex document into smaller pieces. For example, Makefiles, \beginpgfgraphicnamed/\endpgfgraphicnamed when using TiKZ, and splitting a large file into separate chapters are all helpful in splitting a large job into smaller, hopefully independent pieces. But sometimes this is not enough -- many packages do complicated things under the hood, leading to slow document processing.

Are there any tools to help isolate the culprits?

It would be great to also have the profiling tool provide suggestions on ways to speed things up.

share|improve this question
up vote 14 down vote accepted

Perhaps not quite what you're after, but the trace package is used by the LaTeX Project to get a feel for the 'cost' of different things. This package lets you include every TeX expansion and assignment in the log file. So you can check how many lines a particular function adds to the log, which gives you an idea of how hard TeX is working to do whatever you've asked for. Other than that, the approach I take is to create simple test files (say one with a loop to repeat one function many times), then use 'time' at the command line to see what changes as I alter the input.

share|improve this answer
Thanks, this sounds useful! – András Salamon Jul 28 '10 at 16:49

pdfTeX (which is the default nowadays, even if you're generating DVI) has functions for doing timing tests. Use \pdfresettime to start it off and do ‘something’ with \pdfelapsedtime when you're done:


The value of \pdfelapsedtime is the number of seconds elapsed multiplied by 65536.

share|improve this answer
Thanks, will definitely try this out. – András Salamon Jul 30 '10 at 9:06

tikz/pgf seems to provide a general profiler built on top of \pdfelapsedtime to optimise TeX code. See "44 Profiler Library" in its manual from a recent CVS checkout. The stable release pgf 2.0 is out of date.

share|improve this answer
Useful to know, thanks! – András Salamon Aug 12 '10 at 20:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.