91

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...

12
  • 19
    For the editor: an algorithm for choosing a very good editor may be: 1. toss a coin. 2. Heads choose Vim, tails choose Emacs. 3. STOP. However, there is also a better algorithm, which chooses not a good editor, but the best one: 1. choose Emacs. 2. STOP.
    – mbork
    Commented Mar 21, 2013 at 7:00
  • 6
    TeX basically consists of four processors that work in a pipeline (input processor, expansion processor, execution processors, and visual processor). Each can be implemented using a dedicated thread. If TeX is implemented that way, then it's possible to assign each thread to a dedicated core, which should speed up the overall compilation process.
    – user10274
    Commented Mar 21, 2013 at 7:10
  • 21
    @mbork "1. choose Emacs. 2. STOP" Yes, when you choose Emacs, that's when it all stops. At least vim lets you continue working.
    – user10274
    Commented Mar 21, 2013 at 7:44
  • 5
    apres mbork: So now hard core TeXers need a customized rig? It's all about the pps (pages per second). :)
    – Ryan Reich
    Commented Mar 21, 2013 at 13:54
  • 5
    After reading Daniel's answer, I don't know if I should claim to have been joking anymore.
    – Ryan Reich
    Commented Mar 21, 2013 at 13:57

1 Answer 1

100

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.

15
  • 8
    I thought IO should also have quite a bit of influence so I just benchmarked (fast) HD vs. SSD. Given enough RAM the differences under Windows 7 are within a few percent, much less than I thought. It seems that pretty much everything is cached, so yes indeed, CPU power it is. Fortunately TikZ supports multiple cores via the external library so that they can also contribute.
    – Alexander
    Commented Jul 10, 2013 at 12:42
  • 3
    @Alexander: Thanks for sharing this experience. The TikZ externalize/multicore hint is a good one! I have incorporated it into the answer.
    – Daniel
    Commented Jul 10, 2013 at 22:23
  • @Daniel I'm not so sure about the cache size not mattering so much... I do feel it plays a big part. Although the memory usage is not so high, having the information "at hand" should really improve the processing time. Commented Jul 10, 2013 at 23:32
  • 1
    @MarioS.E. Memory is slow, so caches are extremely important. However, because of the locality rule (over short periods of time, >90% of all memory accesses go to a relatively little range of physical memory) even a small cache already has a tremendeous impact – and the benefit of larger caches becomes much less significant. Pdflatex is no exception here, it is a CPU-bound process. The 8MB L3 cache of Core i7 are more than enough.
    – Daniel
    Commented Jul 11, 2013 at 5:53
  • 1
    @DavidZ: The only AMD machine at our lab was the big AMD server (48 x Opteron [email protected] GHz), which was more than ten percent slower than the Intel workstation (8 X Xeon [email protected] GHz). The current Haswell generation is said to have further increased the advantage over AMD, so I would go for Intel. However, to be really sure I suggest to compare the CPU performance benchmark results at cpubenchmark.net or some similar site.
    – Daniel
    Commented Aug 25, 2014 at 16:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .