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.

<strong>The</strong> next lines shows some more variants. <strong>The</strong>re are more than these and we will extend<br />

the repertoire over time. If needed you can dene additional handlers.<br />

performance<br />

Before we continue with more examples, a few remarks about the performance. <strong>The</strong><br />

rst version <strong>of</strong> the parser was an enhanced version <strong>of</strong> the one presented in the Lua book:<br />

support for namespaces, processing instructions, comments, cdata and doctype, remapping<br />

and a few more things. When playing with the parser I was quite satised about the<br />

performance. However, when I started experimenting with 40 megabyte les, the preprocessing<br />

(needed for the special elements) started to become more noticeable. For<br />

smaller les its 40% overhead is not that disturbing, but for large les . . .<br />

<strong>The</strong> current version uses lpeg. We follow the same approach as before, stack and top<br />

and such but this time parsing is about twice as fast which is mostly due to the fact that<br />

we don't have to prepare the stream for cdata, doctype etc. Loading the mentioned large<br />

le took 12.5 seconds (1.5 for le io and the rest for tree building) on my laptop (a 2.3 Ghz<br />

Core Duo running Windows Vista). With the lpeg implementation we got that down to<br />

less 7.3 seconds. Loading the 14 interface denition les (2.6 meg) went down from 1.05<br />

seconds to 0.55 seconds. Namespace related issues take some 10% <strong>of</strong> this.<br />

patterns<br />

We will not implement complete xpath functionality, but only the features that make<br />

sense for documents that are well structured and needs to be typeset. In addition we<br />

(will) implement text manipulation functions. Of course speed is also a consideration<br />

when implementing such mechanisms.<br />

pattern supported comment<br />

a ⋆ not anchored<br />

!a ⋆ not anchored,negated<br />

a/b ⋆ anchored on preceding<br />

/a/b ⋆ anchored (current root)<br />

^a/c ⋆ anchored (current root)<br />

^^/a/c todo anchored (document root)<br />

a/*/b ⋆ one wildcard<br />

a//b ⋆ many wildcards<br />

a/**/b ⋆ many wildcards<br />

. ⋆ ignored self<br />

.. ⋆ parent<br />

a[5] ⋆ index upwards<br />

a[-5] ⋆ index downwards<br />

XML revisioned 135

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

Saved successfully!

Ooh no, something went wrong!