James H profiled the new Same Game grid generator and discovered it
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 22 Jul 2005 11:06:57 +0000 (11:06 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 22 Jul 2005 11:06:57 +0000 (11:06 +0000)
commit43093e371fc9661baaf5a6d51cb1a8810ecffc19
tree9153cfc0f194159faf4d2dd050a5eb935971ecc2
parente4a7ab56a31b3520de433aedf5fdc2460234ead8
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.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6125 cda61777-01e9-0310-a592-d414129be87e
samegame.c