On Sep 2, 9:45 am, [EMAIL PROTECTED] wrote:
> [snip code]
>
> Thanks for that. I realise that improving the algorithm will speed
> things up. I wanted to know why my less than perfect algorithm was so
> much slower in python than exactly the same algorithm in C. Even when
> turning off gcc's optimiser with the -O0 flag, the C version is still
>
> > 100 times quicker.

Well, for one thing, you're creating half a million xrange objects in
the course of the search.  All the C code has
to do is increment a few integers.

Mark

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to