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:


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

Hello World.

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?

  • 1
    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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.