# Slow fontspec with xelatex

I have been using XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015/W32TeX) with fontspec 2015/03/14 v2.4c and recently I have also installed MiKTeX-XeTeX 2.9.6216 with fontspec 2017/01/02 v2.5c. This slowed down things considerably. As suggested in other posts I have tried to cache the fonts by running fc-cache and fc-cache -f. Because I did not see a considerable improvement I used a Process Monitor to check on the xelatex.exe processes. This was the code:

% !TEX TS-program = xelatex
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
Test
\end{document}


Most of the operations run are ReadFile from C:\windows\fonts\Arial...:

Is this to be expected or does it mean that the fonts were not properly cached? I compile with latexmk -xelatex -pvc -synctex=1 and after every change, xelatex.exe reads again the fonts. For the above example everything compiles fast, but in the main document I am compiling everything got considerably slower. Is there anyother way of caching the fonts?

• possibly this issue which is fixed in source but not yet in the distributed texlive, if I understand Ulrike correctly it also affected miktex tug.org/pipermail/tex-live/2017-March/039768.html – David Carlisle Mar 21 '17 at 20:51
• I see a similar list of accesses in a process monitor but xelatex doesn't feel overlay slow for me, imho they are normal: fontspec needs to query the fonts to identify the font features -- the "slowness" due to a missing cache is quite different. (I don't have access to a ARIALN.TTF. Where is this font from?) – Ulrike Fischer Mar 21 '17 at 21:08
• I have seen this before as well with TeX Live. I cannot remember exactly, but I think deleted some XeLaTeX related font caches from texmf-var or such and that helped. IIRC just fc-cache -f was not enough. – wilx Mar 21 '17 at 21:12
• I'm asking because with Tex Live 2015 I do not see the same behavior for xelatex reading the fonts directly from C:\windows\fonts. @Ulrike Fischer The code above is not slow, but the document I have to compile is, and I was thinking it might be because of xelatex and the fonts. (I think ARIALN is Arial Narrow.) – igm2103 Mar 21 '17 at 21:15
• In texlive 2015 the process name seems to be xetex and not xelatex but beside this I see tons of lines with arial too. – Ulrike Fischer Mar 21 '17 at 21:29