xsl-list
[Top] [All Lists]

Re: all-XSLT implementation of Minesweeper

2005-03-17 05:12:11

  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[(_at_)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.

something like

<xsl:key name="bomb" match="bomb" use="concat(@h,':',@v)"/>

then replace the above by

     +  count(xsl:key('bomb',concat($rowH -1,':',$rowV +1)))

that said, it's a nice demo!!
Are you going to do freecell, solitaire and pinball  as well?

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--