Subject: Re: [xsl] all-XSLT implementation of Minesweeper|
From: Sean Whalen <seanwhalen@xxxxxxxxxxx>
Date: Fri, 18 Mar 2005 06:28:29 -0500
From: David Carlisle <davidc@xxxxxxxxx> Subject: Re: [xsl] all-XSLT implementation of Minesweeper Message-Id: <200503171212.MAA04822@xxxxxxxxxxxxxxxxx>
regarding speed, the performance seem to benefit when I changed 2 expressions from "//square" to "SweeperMap/square". But the performances varies a lot by how much free space there is on the map.
similarly you have lots of expresions like this
+ count(//bomb[@h=$rowH -1 and @v=$rowV +1 ])
which are likely to be slow. Even if you change // to a more specific path this cries out to use a key which would probably change the time complexity of the algorithm completely as basically it tells the system to use some space to make some kind of lookup table to find these things quickly.
<xsl:key name="bomb" match="bomb" use="concat(@h,':',@v)"/>
then replace the above by
+ count(xsl:key('bomb',concat($rowH -1,':',$rowV +1)))