[Tutor] 6x6 word square solver too slow

R. Alan Monroe amonroe at columbus.rr.com
Fri Apr 25 03:22:33 CEST 2008


> Here you call join() at the third level of nested for loops.
> And then you call solve recursively at that same level
> where join gets called inside 3 more levels of loop.
> That effectively means join is getting called at 6 levels
> of loop nesting for just one recursive call, but you could
> be doing more than that.

I'm doing zip and list comprehension just as often, and they don't
make a blip in the profiler. Maybe that's a shortcoming of the
profiler itself?

>  In fact it would be an interesting
> exercise to add a counter just before the join call to see
> how many times it gets called altogether - I predict a
> very big number.... :-)

A 2000-3000 per go round.


> However I suspect any attempt to improve performance
> here needs a new algorithm and probably a clever data
> structure to minimise brute force tests.

If I knew of one, I would have used it :)


Alan



More information about the Tutor mailing list