Michael Kay - 2005-03-23

Logged In: YES

Unfortunately the above patch, while correct, can cause a
serious performance regression for some queries. In
particular, it affects queries that write a large number of
parentless elements, in situations where Saxon is able to
hold all these elements in the same TinyTree structure. The
performance regression is caused because the arrays within
the TinyTree structure are condensed after writing each
parentless element, meaning that they have to be expanded
again when the next element is added, with ever-increasing
cost as the arrays get larger. To fix this, the following
patch ensures that condensing of the arrays does not happen
if the TinyTree holds more than one root node (on the
presumption that if it already holds more than one, the
chances are that more will be added.)

In net.sf.saxon.tinytree.TinyTree, method condense() at line
319, add at the start of the method:

if (rootIndexUsed > 1) return;

Michael Kay