On Feb 16, 2009, at 4:33 AM, Stefan Behnel wrote:

> Greg Ewing wrote:
>> In the Pyrex docs there's a list of all the types it
>> knows about and the API calls that it will generate
>> given the right circumstances.
>>
>> Not sure if it's still up to date with respect to
>> Cython, though.
>
> It's definitely not. It's difficult to keep the docs in sync with all
> places where optimisations are done in one way or another. Loops are a
> good example.

It would be nice to have this in the documentation, but there are so  
many little optimizations that it would be a lot to write them all  
down. And it's not very well defined to say "type X is optimized"  
because some operations may be optimized, and some not.

> I think it's actually best to just write your code the way you  
> would in
> Python, and then check the generated C code to see if it comes out as
> expected. That way, you will not only spot places where Cython does  
> not
> optimise as expected (in which case a patch is appreciated, although a
> wishlist bug report will also be helpful), but you will also find  
> places
> where Cython simply didn't know your intention, so that an additional
> "cdef" in the right places will bring you a major speedup. That's  
> pretty
> orthogonal to type specific optimisations.

I heartily second this.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to