Open khaledhosny opened 14 years ago
I guess the problem here is that ConTeXt use precompiled font cache. For example see http://source.contextgarden.net/scripts/context/stubs/mswin/luatools.lua, where the caches.loaddata
first try the compiled version than the text version. In particular of Arno Pro, which is very complicated, I tried the following.
First compiled a document which use almost all the Arno Pro fonts (well, one can construct a document with only those he is likely to use).
Second, now we have temp-arnopro-.lua files in the cache directory. I use texluac
compiled all these files to binary files, and renamed binary files with the ordinal names of lua files.
Third, try the same document again, the output is correct, the compile time reduced from more than 3 minutes to 22 seconds in my case.
This is surely a very very ugly way to do it. It trick luaotfload to load a compiled file instead of plain text file by renaming the binary file to the same names as the *.lua files.
A better way is to patch luaotfload in a similar way to what context do. However, I am not familiar with either luaotfload source of context source, and never had time to look into them carefully enough to create patch myself. But hope the idea an experiment I mentioned above will help.
I had a patch that would enable compiling cache files, but one have to run luatex with --shell-escape
which is not the default (I've to call texluac
from inside the module to compile the file), so I'm not sure how useful is that. Also I'm not getting that much saving, ~1 second in a plain tex file using 18 fonts.
I found that I can use string.dump
, patch sent to Hans and we should get support for compiled cache files with next sync with ConTeXt.
For the time saving, I think that really depends on the fonts, since only the compile time is saved and runtime is still the same.
In addition it is also OS dependent. In may case I always found that in Mac OS X it is much slower than in Linux (the hardware difference is marginal in the sense of linpack benchmark)
This is now available in the unstable
branch, please test (you may need to delete existing cache files first.)
For example, fonts taking huge amount of memory and forever to load, like Arno Pro, take much less time and memory when used with ConTeXt. Someone needs to discuss this with Hans, may be we can share more code than we do now.