[luatex] [lltx] Speeding up otf lua cache file load

Arno Trautmann Arno.Trautmann at gmx.de
Sat Mar 30 18:15:01 CET 2013

Hi all,

Paul Isambert wrote:
> Reinhard Kotucha <reinhard.kotucha at web.de> a écrit:
>> On 2013-03-29 at 23:35:54 +0100, Paul Isambert wrote:
>>
>>   > Dumping formats in order to save time is probably a very good
>>   > solution, even though not very widespread as far as I can tell (I
>>   > myself don't use it, but I'm constantly modifying the files I use...).
>>
>> I could do it because users can't change things anyway.  In medical
>> environments they aren't even allowed to install software themselves
>> and the IT departments will not change anything because they don't
>> want to be responsible if somethings goes wrong.
>>
>> In general it's quite problematic to provide dedicated format files.
>> Suppose you've written a LaTeX .cls file for your students in order to
>> write their theses.  Providing a dedicated format file would speed up
>> things significantly, especially if packages like tikz or pgfplots are
>> used, which load zillions of files.
>>
>> But format files are not portable among different versions of a
>> particular program, a format file created under TeX Live 2012 will not
>> work under TeX Live 2013.  The only reasonable way to distribute such
>> a .cls file is to provide a .zip file which can be extracted either in
>> TEXMFLOCAL or in TEXMFHOME.
>>
>> Font preloading makes sense for particular documents.  But the
>> portability issue of format files remains.
>
> That decided me: I've dumped my usual files into a format; I'd never
> really done it because, besides changing my files a lot, I didn't
> really know how to create a format in TeXLive (a simple shell script
> is a safeguard against my forgetting again), and I knew Lua code
> wasn't dumped so I had to tweak all Lua material so that it is both
> loaded and stored into \everyjob.
>
> The gain in time is quite wonderful. I'm even thinking about writing a
> format for every document, with the relevant fonts preloaded; again a
> simple script could automate that easily.

That's actually an “old” dream of mine: I'd like to be able to
automatically produce a format for any given document (up to
\begin{document}) which is changed if and only if the preamble is
changed. LuaTeX seems to be the simplest way to do this via some Lua
action. However, so far I wasn't even able to produce a format dump on
LuaTeX. (I'm trying to do this by now using the myformat.ltx and
mylatexformat.ltx, but they produce errors when used with LuaTeX. I
still have a lot to learn for producing formats, I guess …)

>>   > > There is not much text in the PDF files, just a few small tables.
>>   > > Maybe this is the reason why the font subsetting doesn't take much
>>   > > time.  The main content of the file are ECG plots created with
>>   > > \pdfliteral.  BTW, my first attempt was to use Metapost but it was
>>   > > much too slow.  Processing data with Lua and writing PDF stuff
>>   > > directly into the PDF file is extremely fast.  It's similar to what
>>   > > you described in a TUGboat article.  The difference is that your
>>   > > approach is more Metapost orientated while mine is more PostScript
>>   > > orientated, just because I don't need a user interface.
>>   >
>>   > Nice to know that article rang some bells.
>>
>> I'm absolutely convinced that many readers enjoyed this article.  Of
>> course, I was interested even more because I was doing something