Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 13 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
add comment

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
add comment

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:

\documentclass{article}
\pdfresettimer
\usepackage{expl3,tikz}
\showthe\pdfelapsedtime
\begin{document}
\end{document}

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
add comment

Your Answer

 
discard

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.