You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Voytenko, Dimitry" <dv...@sectordata.com> on 2003/02/21 03:42:47 UTC

position() = last() optimization feature request

Hi,

Please take a look at the attached letter and response from W3C about
is-last optimization. It looks like this could be advantageous for many
queries (especially for sql extension in streaming mode). XPath expressions
(sub-expressions) of view:
	position() ? last(), where "?" is =, !=, <, >, etc, 

can be easily optimized (org.apache.xpath.compiler.Compiler class) into the
call to the internal "is-last()" function. 
Simpliest (or caching) iterators can implement this call just as "position()
? last()". And more complicated implementations would require (in the worst
case) caching of only one (next) node. So this can really save resources for
many queries. 

I could post changes that need to be done in Compiler class (they'd be
pretty simple). But this would make sense only if DTMManager (and all other
iterator interfaces) would have isLast() method, which already requires
changes to the interfaces. 
>From the iteration standpoint java.util.Iterator and Enumeration interfaces
all have hasNext() method (just as examples).

Please, send your comments if this looks interesting.

In addition, similar optimization could be done for queries "node[last()]"
as call to internal "get-last()" method, and probably some others.

Thanks,
Dimitry 


_____________________________________________________
Sector Data, LLC, is not affiliated with Sector, Inc., or SIAC
 <<RE: Iteration functionality request for XPath 2.0>>