[XeTeX] performance on Windows (and other?) machines

Jonathan Kew jonathan_kew at sil.org
Tue Oct 3 13:38:06 CEST 2006


On 3 Oct 2006, at 12:18 pm, William Adams wrote:

> On Oct 2, 2006, at 4:13 PM, Jonathan Kew wrote:
>
>> Yes, I'd expect it to be faster, though as I don't have anything
>> remotely close to that many fonts, I don't know how much difference
>> to expect.
>
> Why does it have such a negative effect on performance? Does the
> system have to walk through the entire list more than once or  
> something?

(1) When you ask xetex for a font, it first looks to see if it  
already knows this font name; if so, it should be pretty fast (it  
keeps a cache of info on all the fonts it has looked at during the  
job, and access to those should be quick--it's not a linear search).  
Things like optical sizing and style selection happen using that  
cached info.

(2) If it hasn't yet heard of the font, then it asks fontconfig for a  
list of those that match the name you gave, and adds those to its  
cache; then it can choose the appropriate font from its cache, as above.

(3) If fontconfig can't find a match for the name you gave, then as a  
last resort xetex will ask it for the complete font list, cache the  
details of *all* the fonts, and then try again to find what you  
wanted. This covers some messy cases where fontconfig doesn't find  
things by the names you'd expect.

Now, if you have a huge number of fonts, then (3) will clearly become  
slower; at this point, xetex is looking into every font to cache  
names and style information that it needs.

However, my hope is that fonts will normally be found by (2), where  
we ask fontconfig for matches on a name. And then any other font from  
the same family will be found at step (1), already in xetex's cache.  
(Note also that (3) can only happen once per job, as xetex knows when  
it has collected all the available font info, and won't repeat this.)

One thing I don't know is whether/how fontconfig matching performance  
degrades with extremely large font collections. Maybe step (2) above  
can get slow.

Are you able to make some actual measurements with "small" and  
"large" numbers of fonts installed, to give an idea of the effect  
you're seeing? I'm afraid I don't know how to time jobs on Windows,  
but I'm sure there's some way to do this.

JK



More information about the XeTeX mailing list