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.

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

I was thinking it'd be nice to know how much time each package I load adds on to the total time between clicking "compile" and seeing the PDF come up on my screen, so that I can figure out which ones I shouldn't load unless necessary. If there were a way of measuring the precise amount of time it takes to compile (i.e., have the computer measure it, not try to approximate it by hand with a stopwatch), I can just remove one package at a time and measure the differences. But I can't find a way of doing this; I hunted around in the "log" file and didn't see this info, and I couldn't find any packages that add this functionality.

Ultimately, I admit it's not that big of a deal - compiling usually only takes a second, maybe two - but now I'm curious how to do this, and it could be relevant in much larger documents (with longer compile times).

share|improve this question
Related question: how to determine the run time of a loop – Peter Grill Aug 31 '11 at 3:22

This is somewhat OS dependent. On Linux and OS X you can use the time command from the command line.

time pdflatex myfile.tex

returns: (e.g.)

real    0m1.976s
user    0m0.331s
sys     0m0.091s

There may be a similar command in Windows. Depending on your editing environment, you can probably modify the latex command from within the editor (temporarily) to run the time command when you compile, which would make checking the times for different package configurations easier.

share|improve this answer
Thanks for your answer! As I should have mentioned in my question, I'm using TeXnicCenter on Windows, and I'm afraid I don't have any experience running LaTeX (or anything else) from a command line. But I suppose this is good motivation to figure that out :) When you say "modify the latex command", how would I do that in something like TeXnicCenter? – Zev Chonoles Aug 30 '11 at 23:04
@Zev since Windows doesn't have an exact parallel to the unix time command, it's not so obvious how to do this in Windows. There are a bunch of suggestions here: How to measure execution time of command in Windows command line. I don't know how easy any of these would be to integrate with TeXnicCenter. – Alan Munn Aug 30 '11 at 23:18
Ah, thanks for the link - I suppose it might be more involved to do then. – Zev Chonoles Aug 31 '11 at 2:47

By default ConTeXt gives

system          | total runtime: 35.093

at the end of each compile. This is the cumulative for all the runs needed to resolve references, etc. For more detailed usage, there is a timing module, which gives a graphical output of the resources used per page.


The output is similar to the graphs shown in Chapter XIX of the Mk manual.

share|improve this answer
Is there anything that ConTeXt can't do? :-) – Alan Munn Aug 30 '11 at 21:08
It can't reach the mass for now (I'd like to know why). – ℝaphink Aug 30 '11 at 21:50
Thank you for your answer! I'm not sure that ConTeXt is right for me; I'm mainly using LaTeX to type my math homework, and I don't think I need anything fancy (or at least, the discussion here mainly went over my head or wasn't important to me). But it's good to know that this ability exists elsewhere. – Zev Chonoles Aug 30 '11 at 23:14

If you are using the pdftex engine, you can measure the time that each package takes to be loaded by adding the following near the start of your document.

  {\typeout{\strip@pt\dimexpr\pdfelapsedtime sp\relax sec.}}

You could also hook similarly at the end of the document with Heiko Oberdiek's atveryend package: \AtVeryVeryEnd{\typeoutthetime}.

share|improve this answer

The regstats package with option "timer" gives the time needed for the specific (pdflatex) compilation run, using \pdfelapsedtime.

share|improve this answer

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.