GeneralLaTex Compilation & Multi-threading / Multi-core CPUs

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
stantestco
Posts: 8
Joined: Tue Jul 21, 2009 12:13 pm

LaTex Compilation & Multi-threading / Multi-core CPUs

Post by stantestco »

Hello,

I'm currently writing a math book in latex (Miktex 2.8, XeTeX, Windows 7 64-bit) and I was wondering if there is any tex distribution for windows that supports multithreading? It appears as if miktex runs 1 thread when compiling.

I ask this because my book is several hundred pages, however I have broken it down to chunks of 100 pages to ease compilation-- none the less, on a dual core 2ghz with 4gb ram it still takes about 20-30 seconds to compile, and I'm finding this quite a big productivity drain, especially when I have to continuously tweak margins/spacing several times to make a page look proper. My .tex files are 100-300kb, and my style file is 100kb itself. Images range from 20-30kb to 2-3MB for the covers. I extensively use pstricks, pictures (including full-page backgrounds on several pages-- cover, back cover, etc), multicols, opentype fonts, etc-- definitely beyond what a simple math paper with a few equations demands.

I'm considering upgrading to a quad core i7 machine (for general multitasking with 3 24" LCDs), but am wondering if there would be any benefit in regards to tex compilation? If there is any way I could drastically improve compilation times-- which I'm sure could be the case if multithreading were used-- for example an i7 920 2.6ghz overclocked to 4+ ghz (4 cores, 8 with hyperthreading) with 12GB/24GB ram. I have to run Windows 7 and cannot run Unix unfortunately due to several applications I extensively utilize.

I understand that Snow Leopard has a built in multithreader (that runs single-threaded apps on multiple cores automatically), but Windows does not have this feature.

I was also wondering perhaps if I could run a Linux distribution via VMWare inside of Windows 7 that has a built-in multithreader built in? Just a thought.

Any feedback would be appreciated. Getting my latex compilation time down to under 10 seconds would literally make me twice as productive-- it'd be a life saver for me. Again my system is fast, I can compile a simple 100-page thesis in literally <5 seconds, but I need extreme compilation performance. :)

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

LaTex Compilation & Multi-threading / Multi-core CPUs

Post by frabjous »

I rather doubt a virtual machine is going to help with CPU drain!

One thing you might consider is something like the subfiles or subdocs packages, so you can only compile the part of the document you're working on. I haven't tried these personally, but they might help.

Beyond that, I don't know enough about what Windows tools there are that might otherwise help with the problem. In linux, I might use something like gummi, which will constantly update the preview panel in the background while you're working (although with such a large file it won't refresh very often), and even that hasn't quite reached a mature stable version.
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: LaTex Compilation & Multi-threading / Multi-core CPUs

Post by josephwright »

Multi-threading won't help, as TeX is a single thread application. That's not just a case of the compilation, either: the entire way TeX works is linear, I'm afraid.
Joseph Wright
stantestco
Posts: 8
Joined: Tue Jul 21, 2009 12:13 pm

Re: LaTex Compilation & Multi-threading / Multi-core CPUs

Post by stantestco »

Update: I butchered my style file and removed any extra class basically and nullified a lot of my custom commands.

30 page compilation before: 13 seconds on dual core 1.83ghz, 3gb ram.

after: 1 second.

I can just toggle between my draft and xetex .sty files as necessary.
Post Reply