Subject: RE: problem: recursive templates slowing xalan processor down
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 10 May 2004 23:54:46 +0100
|
Can't see anything obviously problematic in this. Saxon eats it in about
120ms.
Michael Kay
> -----Original Message-----
> From: poppe chris [mailto:pc_poppe@xxxxxxxxxxx]
> Sent: 10 May 2004 21:48
> To: jeni@xxxxxxxxxxxxxxxx
> Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: problem: recursive templates slowing xalan
> processor down
>
>
>
> >Hi Chris,
> >
> > > im having a peculiar problem, ive made a xsl stylesheet
> that uses a
> > > recursive template. When i use xmlspy to perform the xsl
> > > transformation on a sample xml file everything works
> fine, but when
> > > i use a xalan processor (org.apache.xalan.xslt.Process) the
> > > recursive template seems to freeze the processing. First I pass
> > > about 15 nodes to the template wich then calls itself
> with one node
> > > less. and so on. In the beginning it goes fast but after
> 3 recursive
> > > calls everything slows down and finally looks like its frozen (in
> > > fact i still get some output but only after very long
> times). Is it
> > > possible that several recursive calls freeze the processor and how
> > > come everything works with the xmlspy debugger??
> >
> >I don't know which processor the XML Spy debugger uses, but it might
> >be that it rewrites (tail) recursive calls into a loop and thus deals
> >with the recursion more efficiently than Xalan.
> >
> >Having said that, Xalan is normally pretty good at that kind of
> >optimisation. (Perhaps you're using an old version? Check which
> >version you're using with system-property('xsl:version').) Seeing a
> >slowdown after only three recursive calls sounds quite severe.
> >
> >Can you show us your recursive template? Perhaps there are some
> >rewrites that could help speed it up...
> >
> Here is a link to the xslt file
> http://www10.brinkster.com/cpoppe/misc/MCTFbit.xsl
>
> And a link to a sample xml file
> http://www10.brinkster.com/cpoppe/misc/coastlittle.xml
>
> What this pretty much does is select all the substream
> elements in the xml
> file, then read in a length ( part of a list) and take the
> sum over these
> values. Ive left a number of things out of the xslt im using
> but this one
> still gives the same problems, starting with 15 nodes then 14
> , 13 and 12
> (and slowing down and once it gets to 11 or even 10 times
> take that much
> time it seems its frozen)
> Im not looking for a completely alternate solution cause ive
> reduced the
> sample xmlfile and the xslt a lot. Just an explanation would
> be helpfull a
> lot!
>
> Ive noticed that when i call the calcPart1 template for the
> first time with
> .../m:substream[last()] (so i only pass about 5 nodes to the
> template)
> everything goes smooth.
> Here is a link to this xslt file
> http://www10.brinkster.com/cpoppe/misc/MCTFbit.xsl
>
> sincerely,
> Chris
>
> _________________________________________________________________
> Download nu MSN Messenger 6.2
> http://messenger.msn.be?DI=1032&XAPID=2604&SU=hotmail.be
|