RE: [xsl] Saxon processing problem...

Subject: RE: [xsl] Saxon processing problem...
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 30 Mar 2008 16:35:43 +0100
> On Sun, 2008-03-30 at 16:00 +0100, Michael Kay wrote:

It was actually 23:00+0800, but my computer didn't know that.

> > The other thing that would make the optimizer's life much 
> easier is to 
> > declare the types of parameters such as $grp-size, in this 
> case using 
> > 'as="xs:double"' in the xsl:param declaration.
> 
> Is there a document or something that describes best 
> practices for making the (saxon) optimizer's life easier?

Sadly, no. But I do tell people repeatedly that declaring the types of
parameters is always recommended. Primarily because it's a good way of
catching your programming mistakes, but it also means that the compiler has
more information to work with. In this particular case the use of $grp-size
inside an arithmetic expression inside a predicate caused Saxon to generate
code to atomize the value of the variable and check that it was
single-valued; it was then trying to move this code out of the predicate to
avoid doing it repeatedly. If the type had been declared, then Saxon would
have known that these run-time checks weren't needed and therefore didn't
need to be optimized.

None of which, of course, directly relates to the bug in question.

Michael Kay
http://www.saxonica.com/

Current Thread