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.

For some reason my document takes very long to compile, and I would like to narrow down why this happens. Finding the bottleneck would be greatly eased if I could time how long individual sections in the code take to compile.

The first and obvious question is: (1) Is there a 'profiler' package that returns how long parts of my documents take to compile?
Such a package should record, for example, how long individual Ti k Z pictures take to compile.

If this should not be an option, I have a second question: (2) Is it possible to output statements into the terminal?
If there was something like a command "shellout(print "Now compiling PGF Plot of weather data..."), that would print a statement in the terminal among all those LaTeX warnings I get, I could at least stop the time myself.

share|improve this question
4  
I have no answer for (1). About (2), you can add the line \typeout{Now compiling PGF Plot of weather data...} in the right point in your document. In this way that line will be printed in the .log file and you should be able to see it in the terminal. –  karlkoeller Oct 2 '13 at 10:05
    
you can use \message to output things on the terminal. –  jfbu Mar 15 at 22:09
add comment

1 Answer

up vote 1 down vote accepted

You could insert a line \typeout{START TRACING}\tracingmacros1 at the start of the sub-part of interest in the latex document, and then \typeout{STOP TRACING}\tracingmacros0at the end of the stuff. This will sometimes considerably slow down the compilation, but once it is done, go to the log file and ask your editor to report the number of lines from START TRACING to STOP TRACING. This line count will give a rough idea of the time taken up by that part of the source. But you need to repeat for another part to compare.

You could also do this simultaneously for various sub-regions of the source, and then compare the line counts.

share|improve this answer
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.