xsl-list
[Top] [All Lists]

[xsl] RE: Self-Recursive Templates that split, Performance tips?

2014-03-12 06:43:48
I'm looking for any pointers on speeding up an algorithm that uses
self-recursion, but the self-recursion can spawn multiple new
instances.

For example, imagine that the template AMOEBA is meant to model an
amoeba walking around on a surface.

AMOEBA is called with two parameters: a location indicating where the
amoeba is and a map indicating the terrain:

<xsl:template name="AMOEBA">
<xsl:param name="location" as "xs:double+"/>
<xsl:param name="Terrain" as "map(*)"/>

And based on the location and terrain, the amoeba takes a new step,
calling itself with the new location and a new terrain map. NOTE: the
new terrain map is a slight modification of the old terrain map.

But sometimes the Amoeba needs to split into two amoeba, so in some
cases the AMOEBA template will actually need to call two separate
versions of itself (with different locations and terrains).

Any tips for how to accomplish this with as good performance as
possible, given that it is impossible for both calls to be in tail
position?
-David


-- 

"A false conclusion, once arrived at and widely accepted is not
dislodged easily, and the less it is understood, the more tenaciously
it is held." - Cantor's Law of Preservation of Ignorance.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>