#13501: Bugs in C3'salgorithm implementation in sage.misc.c3
-------------------------------------------+--------------------------------
       Reporter:  nthiery                  |         Owner:  nthiery     
           Type:  defect                   |        Status:  needs_review
       Priority:  major                    |     Milestone:  sage-5.4    
      Component:  categories               |    Resolution:              
       Keywords:  method resolution order  |   Work issues:              
Report Upstream:  N/A                      |     Reviewers:  Simon King  
        Authors:  Nicolas M. Thiéry        |     Merged in:              
   Dependencies:  #12895                   |      Stopgaps:              
-------------------------------------------+--------------------------------

Comment (by SimonKing):

 Yes, the effect of using the C Api really seems marginal. I defined
 {{{
 def test_pythonic(O,list L):
     cdef int j
     cdef int l = len(L)
     next_item_found = True
     for j from 0 <= j < l:
         if O in L[j]:
             next_item_found = False

 def test_cythonic(O, list L):
     cdef int j
     cdef int l = len(L)
     next_item_found = True
     for j from 0 <= j < l:
         if PySet_Contains(<object>PyList_GET_ITEM(L, j), O):
             next_item_found = True
 }}}
 and obtained:
 {{{
 sage: L = [set(range(i,i+1000)) for i in range(1000)]
 sage: %timeit test_pythonic(1001,L)
 625 loops, best of 3: 116 µs per loop
 sage: %timeit test_cythonic(1001,L)
 625 loops, best of 3: 111 µs per loop
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13501#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to