Soduku

Atanas Banov enterr at gmail.com
Tue Feb 14 22:39:41 EST 2006


you dont measure single run, you measure multiple runs using the
"timeit" module (for me 1000 repeats was about right).

here are some results which i recorded when i was implementing Sudoku
solver (on AMD Athlon 1.25GHz, using the sample shown on www.sudoku.com
front page):

brute: 		    1000 for 83 sec
smart:  	    1000 for 21 sec
brute, bitset: 	1000 for  29 sec
smart, bitset:	1000 for  7.0 sec
smart, bit+que:	1000 for 5.3 sec

so you see the algorithm makes big difference... and so does the data
structure used. i got 15x speed-up that way. i guess i can claim that
my solver runs the sample for 5.3s/1000 = 5.3 ms!

a friend was also implementing sudoku - this time in C - and his
program solves the sample 10000 times for 3.4sec (i.e. for 0.34ms) on
slightly faster machine - so let's say his **highly optimized** C code
is about 10x faster than mine.

- Nas




More information about the Python-list mailing list