2

In pdflatex - how to find bottleneck of long compiling time for my document was the following code snippet given which gives out the compilation time for a site:

\usepackage{atbegshi}
\newcommand\showtimer{%
  \message{^^Jtimer: \the\numexpr\the\pdfelapsedtime*1000/65536\relax}%
  \pdfresettimer}
\AtBeginDocument{\showtimer}
\AtBeginShipout {\showtimer}

The example snippet was given for pdflatex, is it also valid for xelatex?

It was also given without a minimum working example, so where do I have to place it in a document, directly before \begin{document}?

  • 1
    You put this in the preamble of the document (before \begin{document}). But no, it doesn't work for XeLaTeX because it uses a pdfTeX primitive \pdfelapsedtime. – Phelype Oleinik Aug 9 '18 at 18:31
  • Thank you for this fast response, is there a way to get something similar for xelatex? – Arrow Aug 9 '18 at 18:33
  • I think that it is not possible out-of-the-box, like with pdfTeX. See if one of these threads help you: tex.stackexchange.com/q/124476/134574 and tex.stackexchange.com/q/244839/134574 – Phelype Oleinik Aug 9 '18 at 18:36
  • 2
    you can get relative timings by getting each page to write an empty file named by the page number (eg by putting a \write in the page header) then you can look at the creation times for each of the file the file writing will slow down the job but you should still see which are the slow pages. Or if you do not need exact times just watch the terminal output for [1]...[2]... etc and see where there is a pause. – David Carlisle Aug 9 '18 at 18:51
  • Finally I found the source for my long compiling time by random. I replaced many tikz plots by compiling every plot in a single texfile, later I added the regading pdf, that dropped compile time by 20%. But still the compiling time was too long... in the end it where 2 scatter plots from Matlab I had saved as pdf and added to the document with \includegraphics, once I removed them the compiling time dropped from 2 minutes to 10 seconds. I will save the scatter plots as picture as workaround as long as no better solution exists. – Arrow Aug 19 '18 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.