29.05.2014 Views

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

[4] = 200<br />

I mistakingly assumed that this would generate an indexed table, but at tug 2007 Roberto<br />

Ierusalimschy explained to me that this was not that efcient, since this variant boils down<br />

to the following byte code:<br />

1 [1] NEWTABLE 0 0 4<br />

2 [2] SETTABLE 0 -2 -3 ; 1 0<br />

3 [3] SETTABLE 0 -4 -3 ; 2 0<br />

4 [4] SETTABLE 0 -5 -6 ; 3 100<br />

5 [5] SETTABLE 0 -7 -8 ; 4 200<br />

6 [6] SETGLOBAL 0 -1 ; boundingbox<br />

7 [6] RETURN 0 1<br />

This creates a hashed table. <strong>The</strong> following variant is better:<br />

boundingbox = { 0, 0, 100, 200 }<br />

This results in:<br />

1 [1] NEWTABLE 0 4 0<br />

2 [2] LOADK 1 -2 ; 0<br />

3 [3] LOADK 2 -2 ; 0<br />

4 [4] LOADK 3 -3 ; 100<br />

5 [6] LOADK 4 -4 ; 200<br />

6 [6] SETLIST 0 4 1 ; 1<br />

7 [6] SETGLOBAL 0 -1 ; boundingbox<br />

8 [6] RETURN 0 1<br />

<strong>The</strong> resulting tables are not only smaller in terms <strong>of</strong> bytes, but also are less memory hungry<br />

when loaded. For readability we write tables with only numbers, strings or boolean<br />

values in an inline--format:<br />

boundingbox = { 0, 0, 100, 200 }<br />

<strong>The</strong> serialized tables are somewhat smaller, depending on how many subtables are indexed<br />

(boundary boxes, lookup sequences, etc.)<br />

normal compact lename<br />

34.055.092 32.403.326 arabtype.tma<br />

1.620.614 1.513.863 lmroman10-italic.tma<br />

1.325.585 1.233.044 lmroman10-regular.tma<br />

1.248.157 1.158.903 lmsans10-regular.tma<br />

194.646 153.120 lmtypewriter10-regular.tma<br />

128 Optimization

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!