[Dev-luatex] luafontloader virtual access (bug #404, #448)

Hans Hagen pragma at wxs.nl
Wed Sep 8 20:44:07 CEST 2010


On 8-9-2010 6:57, Taco Hoekwater wrote:
> Hi,
>
> On 09/08/2010 07:35 AM, Taco Hoekwater wrote:
>>
>> In punknova.kern, there tend to be 1242 top-level kern array entries,
>> each of which has about a little under a hundred keys. That would be
>> over 100k worth of metatable lookups, and that will definitely be
>> slower than accessing the actual table that is returned at the moment.
>
> Also, each of those metatable calls would introduce a new userdata
> object to be garbage collected.
>
> Hans and I just did some tests, and it seems that the userdata access
> is useful if *but only if* you are very low on memory. In other cases,
> it just adds extra objects to be garbage collected, which makes the
> collector slower. That is on top of extra time spent on the actual
> calls, and even worse: those extra gc objects tend to be scattered
> around in memory, resulting in extra minor page faults (cpu cache
> misses) and all that has a noticeable effect on run speed: the
> metatable-based access is 20-30% slower than the old massive to_table.
>
> Therefore, there seems little point in expanding the metadata
> functionality any further. What is there will stay, but adding more
> metadata objects appears to be a waste of time on all sides.

quite some time went in rewriting mkiv font loading code to do these 
tests and as i don't want to throw it away, mkiv will provide several 
loading methods but the table based one will be the default; we will 
wrap up some stats in an (maybe mapsable) article some day although a 
sound strategy for when to use what method (as taco explained) is not 
possible

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-luatex mailing list