Thanks, Michael, this is very helpful. I spent this evening learning about validation. Perhaps soon I can discontinue the use of writing "$A - $B gt 0" every time I wanted to test "$A gt $B" for numeric variables. :)

I'll probably look into using maps as well once I upgrade oXygen to use Saxon 9.4 natively (I prefer the syntax/implementation of maps in Saxon 9.4 over 9.3).

On Sun, Feb 3, 2013 at 12:59 AM, Michael Kay <> wrote:

On 02/02/2013 22:56, Michael Kay wrote:

I'll have a play with the example and see if I can add any insights.

First experiment: see what the impact of bytecode generation is. Answer: it brings the runtime down from 19.8s to 17.2, perhaps 15%. That's not untypical, but sometimes with stylesheets dominated by computation the effect is much greater; it suggests the time is dominated by something where bytecode generation has relatively little impact.

Next experiment: switch on Java profiling. This shows the performance dominated by two things: ArrayIterator processing, which is presumably the repeated iteration over the elements in the data file, and string-to-double conversion.

Next experiment: run with -TP:profile.html. Unfortunately this causes the transformation to fail with a stack overflow. I think that tail-recursion is being suppressed because it makes it impossible to get a useful execution profile.

Another way of saving the repeated string-to-double conversion cost might be to use a memo function: extract the double value of each attribute of the data file using a function declared with saxon:memo-function="yes".

Using tunnel parameters isn't going to help performance. The cost of passing the parameter is negligible; it's the cost of repetitive processing of the data that's the concern. Try passing 5 parameters, each a sequence of xs:double values, rather than a sequence of elements containing these five numbers as attributes.

Michael Kay

Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
saxon-help mailing list archived at


"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.