[Tex/LaTex] Tips for choosing hardware for best LaTeX compile performance

performance

Which things should one have in mind when one wants to buy new hardware optimized for best (pdf)latex performance?

For example one might think the more cores on your cpu the better. But since latex is a linear thing there is no much space for parallelizing. So the number of cores seems not to be so important.

What features of your new system especially the cpu are crucial for best latex performance?

Which features that are usually important for good performance for general use are not crucial for latex performance?

Edit:

Clearly you could simply choose the most expensive high end system you can get. However usually one has a budget and the question is really about which parts of the system and features in detail are crucial for latex compile performance and which are not so important because latex cannot use it for example…

Best Answer

In the end, it is only one thing that really makes a difference: Single-Threaded CPU power!

I do a lot of LaTeX compiling, especially of large beamer presentations (lecture notes with 500+ slides, lots of overlays and lots of TikZ stuff). Compilation time with three pdflatex runs usually takes minutes.

I have done experiments with this setting on a bunch of different machines at our lab, from my dual-core notebook over ordinary quadcore PCs with 2 to 4 GB of RAM up to an 48-core AMD server with 32 GB of RAM and ultra-fast SCSI disks.

I don't have recorded the actual numbers of these tests. However, the result roughly is: compilation times scale nearly linear with the CPU clock. It's the fasted Core i7 that makes the run; memory and disk plays only a minor role (given that you provide modest quality and size of both).

The results should not be surprising:

  • Compiling LaTeX documents does not consume a lot of of memory by today standards. On a machine that is able to execute Word at modest performance, you will never hit the memory barrier when using LaTeX.
  • LaTeX does do a lot of IO, that is true. Nevertheless, even with a slow hard disk, the IO load does not take more than a couple of milliseconds. For the second and third compiler run, most files are in the buffer cache anyway.
  • None of the existing TeX/LaTeX compilers use thread-level parallelism and, thus, would profit significantly from multiple CPU cores. Also the typical three pdflatex runs cannot be parallelized, they have to be executed sequentially. In some cases it might, however, be possible to use process-level parallelism, so that multiple cores can speed up the compilation process:

    • For my beamer lecture notes, I maintain a "presentation", "handout", and "notes" version. When I am done with editing, I usually compile all three in parallel to speed things up.
    • With the TikZ external library, it is possible to compile your TikZ figures in parallel in background processes and include them as PDFs. If your document contains many complicated TikZ or pgfplots images, multiple cores could speed up this process. (Thanks to Alexander for this hint!)
  • I have not done any tests regarding cache size, but as the memory load is low, we can not expect a significant benefit of extra-large caches.

To sum up: For a "LaTeX machine" it is the processor and in particularly it's single-core throughput one should look for.

However, the latter is not always easy to figure out, as basically all processors nowadays are multi-core and benchmarked and advertised with their multi-core throughput. A good starting point is the PassMark CPU Benchmarks site, which provides a frequently updated report on "Single Thread Performance" for all current IA32e/AMD64 CPUs.