The experimental facility for pull processing, first introduced in Saxon 8.3, has been significantly enhanced.
It should still be regarded as experimental. It is now possible to execute a query or transformation in
"lazy construction" mode. This means that
if the query constructs a tree, the tree is not actually instantiated in memory: instead, the application may read
the events comprising the tree (startElement, endElement, and so on) using the
PullProvider interface directly.
There is a new option called
LazyConstruction defined in the Configuration. By default, this
is switched off. If switched on, a document or element constructor instruction that is evaluated in "pull" mode
is evaluated lazily, so the tree is not immediately constructed. Some operations on the resulting virtual node
(for example, use of any path expression) will cause the construction to take place, but other operations are
possible without ever constructing the node.
The option can be switched on from the Java API for both XSLT and XQuery. For XQuery it can also be
switched on from the command line using the
The performance benefits of this mode have yet to be fully assessed. For most queries, it has little effect. There seem to be some queries that benefit greatly, but others where the performance is worse.