# Using fontspec (which requires exp3-code.tex) makes lualatex slow

I recently tried luatex (TeX Live on Mac) and found that if I use fontspec to load a font, it really slows down the compilation. My test document:

\documentclass{article}

% \usepackage{fontspec}
% \setmainfont{ProximaNova}[
%     Path=fonts/,
%     UprightFont=*-Regular,
%     ItalicFont=*-RegularIt,
%     BoldFont=*-Bold,
%     BoldItalicFont=*-BoldIt]

\begin{document}
Hello World.
\end{document}


If I keep the font section commented out, it takes 0.7 seconds to generate the PDF. If I uncomment the font section, it takes 2.7 seconds. That's almost 4x.

A huge chunk of this 2 sec increase seems to be processing expl3-code.tex which someone else complained about also.

Can this file be pre-compiled or something else to make it load faster?

• As the question you link to notes, expl3 is quite large, but on most systems the load time is pretty trivial (certainly less than a second). Other than building stuff into the format file there's not much that can be done to load material faster. – Joseph Wright Nov 18 '18 at 15:50
• The complain about expl3 in the other question was a bug in miktex which has been resolved in the meantime. lualatex is slower than pdflatex - loading rather large fonts needs more time. – Ulrike Fischer Nov 18 '18 at 16:02
• @DavidCarlisle With \usepackage{expl3} it takes 2.2 seconds, which is 80% of the time increase. – Roxy Nov 18 '18 at 16:05
• @Roxy Sure, but from a very low base. With LuaTeX, we have a load of Unicode data needed that's not in pdfTeX (where the load time is really low). It's very hard to cut that down, as I said unless we went down the route of building expl3 directly into the LaTeX kernel. That has been discussed, but there are issues with doing that globally ... – Joseph Wright Nov 18 '18 at 16:07