[Pyrex] Question, plus suggestions for improvement?

Bill Mill bill.mill at gmail.com
Wed Aug 2 03:37:14 UTC 2006


On 8/1/06, Giovanni Bajo <rasky at develer.com> wrote:
>
> OK you are right for this very algorithm. In fact, why is a permutation
> algorithm needed in Pyrex at all? I usually use this recipe:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465
> which works quite well for me. I'd be surprised if the actual computation of
> the permuation was a bottleneck.
>

Permute2 algorithm in pyrex, on [i for i in range(1, 10)]: 1.99 seconds
Probstat, on [i for i in range(1, 10)]: 2.88 seconds
Permute2 algorithm in pure python, on [i for i in range(1, 10)]: 4.98 seconds
Xcombinations from that recipe, on [i for i in range(1, 10)]: 64.69 seconds

Seems worth it to me. Also, psyco slows the pure python version down,
so that's not an answer either. Hopefully, Josiah's code will speed it
up even further, I'll know in a bit.

Peace
Bill Mill
bill.mill at gmail.com



More information about the Pyrex mailing list