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.

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

share|improve this question
3  
LaTeX depends on input/output, so caching at CPU and OS level may have a big impact on performance. Since caching support may be implemented by different threads/processes, having more cores can be a great advantage. –  Marc van Dongen Mar 21 '13 at 6:52
8  
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 Mar 21 '13 at 7:00
4  
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. –  Marc van Dongen Mar 21 '13 at 7:10
3  
@MarcvanDongen: though I'm afraid even Taco is not brave enough to reimplement TeX that way... The communication between these "threads" is quite complicated... –  mbork Mar 21 '13 at 7:15
9  
@mbork "1. choose Emacs. 2. STOP" Yes, when you choose Emacs, that's when it all stops. At least vim lets you continue working. –  Marc van Dongen Mar 21 '13 at 7:44

1 Answer 1

up vote 46 down vote accepted

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.

share|improve this answer
5  
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 Jul 10 '13 at 12:42
1  
@Alexander: Thanks for sharing this experience. The TikZ externalize/multicore hint is a good one! I have incorporated it into the answer. –  Daniel Jul 10 '13 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. –  Mario S. E. Jul 10 '13 at 23:32
    
@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 Jul 11 '13 at 5:53
    
Even with a complete ramdisk setup (put all files inside a ramdisk), there are only few percent. –  math Mar 4 at 8:41

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.