Stefan Behnel wrote:
> Hi,
> 
> Dag Sverre Seljebotn wrote:
>> Gary recently voiced concern over dict-based visitor lookups perhaps
>> giving a speed penalty
> 
> Why? You could use lazy initialisation. Just look up a node type in the dict
> (which is fast) and if it's not in there yet, walk it's base types (adding
> each one to the dict) until there is one that already is in the dict, which
> then determines the result for the lookup and for the newly added base types.
<snip>

Sure, sure, that's already being done and in fact you'll see that 
*exact* procedure in my patch! :-) The issue Gary has is indeed with raw 
dict lookup performance. (Consider that this will be between 10 and 50 
times to every single node in the tree of a file.)

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.
"""

Apparently, you don't agree with Gary here :-)

Since this will have a big effect on all of Cython I thought I'd 
investigate it properly before truncating Gary's -Infinity to -1 :-)

--
Dag Sverre



-- 
Dag Sverre

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

Reply via email to