# What affects compilation times, especially in longer documents?

I'm about to start working on my dissertation in LaTeX. It will be the first thing I've worked on longer than ~80 pages and will likely include more figures than is usual for me.

Since I compile frequently, I'd like to minimize the compilation time, but I'm not sure exactly what affects compilation time. What affects compilation time and what are the "usual suspects" when it comes to relatively long compilation times (e.g., I've been told that merely loading TikZ, regardless of whether or not you actually utilize TikZ code in your document, significantly increases compilation time)?

• The engine you use affects it. (At least on my system, XeTeX and LuaTeX are noticeably slower than pdfTeX or TeX.) And yes, the number of packages, what is in those packages, the nature of your code etc. TikZ definitely slows things down, especially if you use it, but so does including external graphics. So does microtype. So use a `draft` mode and set it up to not compile stuff you don't need. Also, put each chapter in its own file and just compile the part you are working on - don't compile the whole thing every time. – cfr Aug 25 '14 at 1:36
• First of all, I'd be surprised if compiling an 80 page document will take long on a modern machine. However, if you have lots of pictures and you create them programmatically this may take a while. For example, creating TikZ pictures from scratch will take a while. (However, see the section Externalization Library .) – user10274 Aug 25 '14 at 7:58

Once in a while I negotiate a contract with somebody: Emacs on the screen of my laptop, Okular displaying the PDF on the LDC projector. To get a change of the *tex file displayed quickly, I make Emacs save the *.tex file 1.5 s after I stop typing. Usually I create a format and run latexmk in the background. This makes the compilation start quickly. To shorten the time needed for compilation, I can recommend these steps:

• Two make compiling fast, building a format is helpful, see here: https://tex.stackexchange.com/a/15606/4736. Unfortunately I often forget about the format, change something in the preamble and wonder, why it doesn't work. Sigh.

• If you use `\includegraphics`, use the "draft" option as well (`\documentclass[draft]...`).

• It is much faster to compile a document with the font "lmodern", compared to Linux Libertine e.g.

• pdfLaTeX is much faster than everything else in producing a PDF.

• Save your files on the local harddisk, compiling a file that resides on a server is slower -- but don't forget the backup.

• The texlive installation on my Linux machine is much faster than texlive on Windows 7. I never found out, why.

• Don't make *LaTeX compile pictures over and over again, this is really time consuming. I don't know whether there is something like "draft" to display only a box of a tikz picuture, but if not, please ask a separate question.

A disadvantage of latexmk is, that it produces things like bibliography, index and whatever every run, so starting compilation manually might lead to shorter compilation.

• On your last point: Tikz supports `externalize` which saves the pictures to not recompile them. To combine that with the `draft` option, see for example tex.stackexchange.com/questions/47444/… – papabravo Sep 3 '14 at 12:19