[Pyrex] Question, plus suggestions for improvement?

Bill Mill bill.mill at gmail.com
Wed Aug 2 23:22:47 UTC 2006


> > I have to report, unfortunately, that my working version of your code,
> > which I dubbed PermuteJ, ends up being a bit slower than Permute2. My
> > guess is that the cost of transferring the C array to the Python one
> > for every iteration outweighs the benefit of the quicker C accesses,
> > but I have not really tested that assertion.
> >
> > (I posted my modified version of your code at
> > http://www.bigbold.com/snippets/posts/show/2353 ).
>
> It is unfortunate that it doesn't happen to be faster for your input.
> On the upside, this particular method should improve the speed of
> permuting objects whose comparison is relatively slow (classes
> implemented in Python, nontrivial strings, tuples, and other containers),
> and it should work for arbitrary input.
>
> One thing that may improve speed generally is a replacement of the
> assignments with PyList operations, or even direct pointer manipulation;
> as this algorithm shouldn't result in refcount changes.
>

I'm working on that one - I'll report any progress I make there.

Thanks again
Bill Mill
bill.mill at gmail.com



More information about the Pyrex mailing list