Dimitre Novatchev [dnovatchev(_at_)yahoo(_dot_)com] wrote:
I have both bad and good news for you.
The Bad News:
The recursive algorithm isn't the fastest.
The Good News:
I am enclosing here the code implementing the fastest (that I
know of) algorithm, anf it is non-recursive.
Wow! Its all good news the way I see it... My testing of your
stylesheet has confirmed your results. Personally, I think your
algorithm should be immortalized in Dave Pawson's FAQ :-)
The non-recursive algorithm exhibits linear behaviour with
MSXML4 and Saxon and sub-linear! one with JD, XalanJ and
XalanC.
Sweet!
I could try still speeding up the non-recursive algorithm, by
using a faster search than linear to find the position of a
record node in the string with positions -- this will require
that all positions must have the same (some maximum) length.
Or I could record the positions in a node-set, for which
binary search is straight-forward.
In case you are still not satisfied with the speed of the
non-recursive algorithm, just let me know :o)
Well, I'm more than satisfied with it, but if you want to make
it even faster, don't let me stop you :-)
Hope this helped.
It certainly did! I'm going to apply your algorithm to my real
problem straight away. Thanks.
Cheers,
Raman Gupta
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list