[luatex] Why accessing font.fonts table is so slow?

Taco Hoekwater taco at elvenkind.com
Fri Jul 30 09:07:49 CEST 2010

On 07/29/2010 09:48 PM, Khaled Hosny wrote:
> After struggling the whole day trying to figure out why my less than 300
> lines of code are so slow, I found that all the slowness comes from
> accessing font.fonts table, which would take from 0.02 to 0.07 seconds
> each time, getting rid of that drops my test file from ~16 to ~2
> seconds. Now I'm just wondering if this slowness is expected, and
> wither it deserves a small warning in the manual (it would have saved my
> day if I knew it beforehand), I read it is not a real table, but nothing
> suggests the slowness I'm getting.

I've added this paragraph to the manual:

Note that at the moment, each access to the \type{font.fonts} or call
to \type{font.getfont} creates a lua table for the whole font. This
process can be quite slow. In a later version of \LUATEX, this
interface will change (it will start using userdata objects instead of
actual tables).

Best wishes,

More information about the luatex mailing list