[Tex/LaTex] XeLaTeX runs slow on Windows machine

xetex

I am running TeXLive 2016 on a Windows 7 machine. In the past, when I ran XeLaTeX on a new file that used mathspec, the first compilation would take a long time, regardless of the length of the document. (For what it's worth, I am using the Calibri font.) Watching the Build Output scroll by (using TeXnicCenter), there would always be a pause on the line

xelatex> (c:/texlive/2016/texmf-dist/tex/latex/euenc/eu1enc.def)

which comes right before the line

xelatex> (c:/texlive/2016/texmf-dist/tex/latex/euenc/eu1lmr.fd).

After this first compilation, xelatex would run fast, comparable to pdflatex (if I didn't use mathspec).

Now it hangs at this spot all the time, adding 20+ seconds to each compilation. Is there something that I can do to speed this up?

EDIT: On the advice from the comment, I ran a process monitor and it seems that xelatex.exe is reading every font in my fonts directory. Is there a way to keep that from happening?

Best Answer

I've been wrestling with the same issue too after upgrading TeXLive from 2013 to 2016. Each compilation started to take over a minute and the process monitor showed a lot of font files being read.

Running fc-cache.exe from the LaTeX distribution's bin folder (as indicated by the comment above) fixed the issue without reinstalling TeXLive.

Please note that the distribution's texmf-var\fonts\cache folder needs to be writeable to the user running fc-cache.exe.