You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/03/13 03:32:30 UTC

DO NOT REPLY [Bug 17941] New: - position() = last() optimization

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17941>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17941

position() = last() optimization

           Summary: position() = last() optimization
           Product: XalanJ2
           Version: CurrentCVS
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: org.apache.xpath
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: dvoytenko@sectorbase.com


Idea: 
Replace expressions in the form of "position() X last()" to the call of 
internal optimized function FuncIsLast. This approach improves performance of 
such queries and allows to obtain correct results for streaming documents such 
as org.apache.xalan.lib.sql.SQLDocument. All these benefits come in expense of 
caching just one node per "position() X last()" predicate in the nodeset.

Changes:
All changes are groupped into three attachments: "cvs diff" with current CVS 
revision and two new files: FuncIsLast amd DTMIteratorIsLast.

Basic Changes:
1. New interface org.apache.xml.dtm.DTMIteratorIsLast is intended to work with 
DTMIterator and responsible for this optimization. It just defines one method: 
isLastPos. 

2. extended interface org.apache.xpath.axes.SubContextList to include similar 
method isLastPos.

3. added internal function org.apache.xpath.functions.FuncIsLast. This function 
is created as the result of optimization. It uses DTMIteratorIsLast.isLastPos 
and SubContextList.isLastPos methods if available, otherwise, it 
performs "position() = last()".

3. Class org.apache.xpath.compiler.Compiler: added code for optimization of 
expressions "position() X last()", where X is '=', '!=', '>', '<', '>=', '<='. 
Const OPTIMIZE_IS_LAST switches this optimization on/off.

5. Classes in the org.apache.xpath.axes package: implemented next-node-prefetch 
system for is-last optimization.

Testing:
Obtained code has been tested against existing conf-gold tests. No problems 
have been discovered. Results of testing will be posted as an additional 
attachement.

Peformance:
Performance testing was executed. Results will be posted as an additional 
comments.