#14214: Cythoned homsets
----------------------------------------------+-----------------------------
       Reporter:  SimonKing                   |         Owner:  tbd             
          
           Type:  enhancement                 |        Status:  needs_work      
          
       Priority:  major                       |     Milestone:  sage-5.9        
          
      Component:  performance                 |    Resolution:                  
          
       Keywords:  Hom, cython, cached method  |   Work issues:  Do not change 
cmp too much
Report Upstream:  N/A                         |     Reviewers:                  
          
        Authors:  Simon King                  |     Merged in:                  
          
   Dependencies:  #14159, #12951, #13184      |      Stopgaps:                  
          
----------------------------------------------+-----------------------------

Comment (by nbruin):

 For me, the `self.__cached_method['_domain'] = D` does not work.
 Furthermore, are you sure property access is not competitive? My tests
 seem to indicate it is:
 {{{
 sage: cython("""
 sage: from sage.misc.cachefunc import cached_method
 sage: from sage.structure.parent cimport Parent
 sage: cdef class T(sage.structure.parent.Parent):
 ...       @cached_method
 ...       def C(self):
 ...           return 10
 ...       property B:
 ...           def __get__(self):
 ...               return self.__cached_methods['C'].cache
 ...           def __set__(self,value):
 ...               self.__cached_methods['C'].cache=value
 ...
 sage: """)
 sage: A=T()
 sage: A.C()
 10
 sage: A.B
 10
 sage: timeit('A.C()')
 625 loops, best of 3: 389 ns per loop
 sage: timeit('A.B')
 625 loops, best of 3: 229 ns per loop
 sage: A.C()
 20
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14214#comment:24>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to