logo       

RE: Template recursion, StackOverflowError, saxon:while a nd variable assig: msg#00085

text.xml.saxon.help

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

saxon:assign isn't actually the only side-effect problem in XSLT. There are
also extension functions, xsl:result-document, and the problem of
expressions that create new nodes (with distinct identity) each time they
are evaluated (I call these "creative expressions").

Each of these constructs imposes slightly different problems. Both
xsl:result-document and creative expressions require some kind of guarantee
that the expression is actually evaluated when invoked. But they don't
impose any constraints on order of evaluation.

I've just done a bit of investigation into saxon:assign and found an
optimization bug:
https://sourceforge.net/tracker/index.php?func=detail&aid=1221623&group_id=2
9872&atid=397617

This is fairly typical of the problems saxon:assign causes. The fix in this
case is partly to treat it like instructions that create new nodes (even
though it doesn't), and partly to avoid doing the normal optimizations on
its select expression.

As the Saxon optimizer gets smarter and lazy evaluation gets used more and
more extensively, this problem can only get worse.

Saxon 8.5 will include some join optimization, so that a construct written
as nested loops will actually be evaluated using hashing and indexing. This
will further add to the unpredictability of order-of-execution. I'm not
going to let saxon:assign (or extension functions with side-effects) get in
the way of performing such powerful optimizations. I may in some cases have
to provide mechanisms to switch the optimizations off, but as a general
rule, if you write stylesheets that have side-effects then you're running
against the grain of the language.

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
> [mailto:saxon-help-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx]
> On Behalf Of
> Willink, Ed
> Sent: 15 June 2005 18:44
> To: 'saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx'
> Subject: RE: [saxon] Template recursion, StackOverflowError,
> saxon:while a nd variable assignability
>
> Hi
>
> > For assign, I have a few use cases but they are quite intricate.
> >
> > I could try to extract their essence and return with more
> > info but is this
> > forum the right place for this?
>
> Yes, because saxon:assign is what needs replacing.
> Yes, because saxon:something-better is the most likely thing to
> appear soon.
> No, but where else can XSLT 2.1/3.0 be profitably discussed?
>
> > Just from memory I would say that typically they are global
> > accumulators
> > that maintain some form of changing status maintained and shared by
> > multiple processes, and changing over time, in real-time, for
> > example,
> > real-time streaming security analysis, in parallel processing
> > pipelines,
> > over graphs of potentially billions of nodes (that you would
> > not want to
> > copy over too often, especially on-line), 24/7, with a large
> > number of
> > users (ex: 120 000 000/week).
>
> Quite some time ago, possibly in Proc ACM, I came across a paper
> showing that a functional language was finally outperforming
> Fortran on big array computations.
>
> A functional language appears to do lots of copies, but by ensuring
> that the compiler understands their lifetime, the compiler can
> actually do re-use.
>
> So 'copying' mega-graphs in order to do an 'assign' isn't necessarily
> a problem, just so long as the compiler eliminates the copy and
> ends up doing your saxon:assign declaratively.
>
> Perhaps this is an optimisation that can be performed as-is.
> Perhaps there are a few programming practices that could be
> observed to ensure that techniques such as tail-recursion can
> be more generally effective.
>
> Michael?
>
> Regards
>
> Ed Willink
>
>
> -------------------------------------------------------
> 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_id=7477&alloc_id=16492&op=click
> _______________________________________________
> saxon-help mailing list
> saxon-help-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
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_id=7477&alloc_id=16492&op=click


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

News | FAQ | advertise