simon-svn: puzzles: simon
tartarus-commits at lists.tartarus.org
tartarus-commits at lists.tartarus.org
Fri Jul 22 12:06:57 BST 2005
SVN root: svn://ixion.tartarus.org/main
Changes by: simon
Revision: 6125
Date: 2005-07-22 12:06:57 +0100 (Fri, 22 Jul 2005)
Log message (9 lines):
James H profiled the new Same Game grid generator and discovered it
was spending 60% of its time in shuffle(). The purpose of the
shuffle() call was to go through a largish array in random order
until we found an element that worked, so there's no actual need to
shuffle the whole array every time and I only did it out of
laziness. So I now pick a random element each time I go round the
loop, meaning I save a lot of shuffling effort whenever the loop
terminates early (which is often). I get about a factor of two speed
improvement from this small change.
Modified files:
U puzzles/samegame.c
Links:
http://www.tartarus.org/~simon-anonsvn/viewcvs.cgi?rev=6125&view=rev
http://www.tartarus.org/~simon-anonsvn/viewcvs.cgi/puzzles/samegame.c?rev=6125&r1=6124&r2=6125
More information about the tartarus-commits
mailing list