logo       

Re: Template recursion, StackOverflowError, saxon:while a nd variable assig: msg#00096

text.xml.saxon.help

Subject: Re: Template recursion, StackOverflowError, saxon:while a nd variable assignability

On 6/16/05, Michael Kay <mike-JkSD5nQpfvpWk0Htik3J/w@xxxxxxxxxxxxxxxx> wrote:
> > See also an example of "environment" that contains a set of
> > "variables", the values of which can be modified:
> >
> >
> > http://www.mulberrytech.com/Extreme/Proceedings/html/2003/Nova
> > tchev01/EML2003Novatchev01.html#t3.6
> >
>
> I've just taken the opportunity to re-read this excellent paper.
>
> This style of programming, where updating an environment involves copying
> the old environment using xsl:copy-of and appending a new name=value pair,
> should benefit greatly from the optimization introduced a couple of releases
> ago whereby xsl:copy-of creates a virtual copy of a tree rather than a real
> copy. This won't reduce the search time for getting the value of a
> particular variable in the store, but it will greatly reduce the copy time
> and the use of memory; and for an environment that only contains the
> (changing) value of one variable, this is what matters.
>
> The virtual copy is in essence just a pointer to the node that has been
> copied. The virtual nodes in the virtual copy are instantiated only when
> they are referenced, and themselves consist simply of pointers to the
> original nodes: they differ from the original nodes only in that they have
> different node identifiers (and thus a different position in document order)
> and that axes cannot navigate outside the subtree that was copied. A copy of
> a virtual copy is implemented as a virtual copy of the original, to avoid
> long chains of indirection.
>
> I would definitely recommend anyone who thinks they need saxon:assign to
> take a serious look at this solution.


If I understand well, this means that with the virtual copy
optimization performing N "assignments" will require only

O(N) total space
vs
O(N^2) total space without the optimization.


Is this right, Mike?

If yes, this is definitely a HUGE improvement !!!


Cheers,
Dimitre Novatchev.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise