Soduku

Jack Diederich jack at performancedrivers.com
Tue Feb 14 20:51:53 EST 2006


On Tue, Feb 14, 2006 at 05:32:48PM -0800, Jonathan Gardner wrote:
> Here at my job, Python gets no respect.
> 
> A programmer here wanted to see which language among Python, Perl, and
> Java was better. So he wrote a Python, perl, and Java version. Except
> the Python version was 20x slower than the perl and Java versions.
> 
> Well, luckily he asked around in our little Python group about what he
> did wrong. He simply misindented a block of code, making it run 10x as
> often as it needed to. With that one fix, it was running faster than
> the Java and perl versions, about 2x as fast. A few other minor tweaks
> made it run even faster.
> 
> And we've been playing with different algorithms for soduku solutions.
> I had it down to 27 ms to solve the puzzle.
> 
A nice story to hear, did you measure how long each of the solutions
took you to write (even if it was just a wrote translation of the same
strategy)?

Is my math off or does 27ms mean 0.027 seconds? On my laptop (1.3GHz) 
an empty python program takes 10ms to run (0.010 secs).  I ask out of
vanity, my own solver takes .15 seconds to run (20 seconds for a 16x16 grid).

-jackdied




More information about the Python-list mailing list