Redundent Expression Elimination branch checkin. This branch is for major
optimization work being done. I expect it to be folded in on the main branch
within a couple of weeks.
Goal of branch: around 50% overall performance gain.
Major architectural changes
1) Rip out cacheing in all iterators, and move the caching into XNodeSet (actually NodeSequence where the caching is done derives from XObject and XNodeSet derives from NodeSequence). Lots of other changes went into this, including rewriting of some of the xsl:key stuff.
2) Implementation of a Visitor mechanism for the stylesheet and xpath components. Each component for an XPath event is passed an ExpressionOwner, which just has a getExpression and setExpression method, which allows us to create a list of these, and then be able to do rewrites. This should be a generally useful mechanism for all sorts of stuff, and should be considered a public API.
3) Implementation of deepEquality methods for all XPath components, which allows us to see if two components are equal.
4) Implementation of RedundentExprEliminator, which is a derivative from the new XSLTVisitor class, which runs over the stylesheet collecting xpaths within the same scope, and absolute xpaths that are not context dependent. These are then each reduced by walking the list and checking for deep equality (though global paths are always reduced). Reduction takes place by creating variables that have a special namespace and a non-legal local name. Both full and partial path reduction done.
Not done yet: Add back in the xsl:key caching that I ripped out (not a big deal). Could be skipped, with some risk.
Not done yet: Implement isLast function. With the new stuff, the last() function will be slower, so, since most cases are just checking to see if an item is the last, I want to rewrite foo[last()] patterns to foo[xalan:isLast()]. Could be skipped, with some risk.
Davanum performance test result: 4x increase in performance.
Datapower performance suite results: very slight decrease in overall performance. :-(
Smoke test results: All clear when run with Xerces 1.
To Do on this branch:
Christina trace/debug API enhancements.
Possible unroll of recursive evaluation.
Implement serializers directly off of ResultTreeHandler (and provide ContentHandler adapters).
Specialize and optimize serializers for 80% cases.
109 files changed