On May 12, 2008, at 3:54 AM, Stefan Behnel wrote:

> Hi,
>
> Dag Sverre Seljebotn wrote:
>> I'll quote Gary so you have the context:
>>
>> """
>> Efficiency does matter to Sage though, and an O(1) overhead is very
>> far from negligible.  Cython uses real C vtables, so there are
>> absolutely no dict-based lookups involved with cdef class
>> polymorphism.  -Infinity to any proposal that makes code slower.
>>
>> <new post>
>>
>> Well, clarifying what I meant a bit more, the *biggest* speed loss
>> anywhere is dictionary lookups.  If your going to use dictionary
>> lookups at object time, you lose most of the advantage of using  
>> cython
>> to compile cython.
>> """
>
> I don't think the intention to compile Cython should impact our design
> decisions. If a Cython compiled Cython compiler is not any faster  
> than a
> Python based one, then that's a reason to improve Cython, not its  
> code.


I fully agree here. I think that when Cython compiles a py file, it  
should intelligently (optionally) decide to cdef and cpdef classes  
and methods. Just having the self parameter typed is a huge gain,  
even if nothing else is. Between that and type inference, there  
should be significant gains.

In terms of adding a visit() function to each node, that is tiny  
compared to the work of implementing the actual visitor functions for  
a single phase, so if this can be optimized by using vtables then I  
think we should probably do it (perhaps eventually, no urgency here).

- Robert

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

Reply via email to