#13400: Use strong caches diligently
-------------------------------+--------------------------------------------
       Reporter:  nbruin       |         Owner:  robertwb     
           Type:  enhancement  |        Status:  new          
       Priority:  major        |     Milestone:  sage-wishlist
      Component:  coercion     |    Resolution:               
       Keywords:               |   Work issues:               
Report Upstream:  N/A          |     Reviewers:               
        Authors:               |     Merged in:               
   Dependencies:               |      Stopgaps:               
-------------------------------+--------------------------------------------

Comment (by SimonKing):

 Here is the effect of cythonising the subcategory hook:
 {{{
 # This is the cython version of the default _subcategory_hook_:
 sage: cython("""
 ....: include "../ext/python_type.pxi"
 ....: def subcat_hook(self,c):
 ....:     return PyType_IsSubtype(c.parent_class, self.parent_class)
 ....: """)
 sage: C = Algebras(ZZ)
 sage: R = Rings()
 sage: C._subcategory_hook_(R)
 False
 sage: R._subcategory_hook_(C)
 True
 sage: subcat_hook(C,R)
 False
 sage: subcat_hook(R,C)
 True
 sage: %timeit C._subcategory_hook_(R)
 625 loops, best of 3: 1.94 µs per loop
 sage: %timeit R._subcategory_hook_(C)
 625 loops, best of 3: 2.09 µs per loop
 sage: %timeit subcat_hook(C,R)
 625 loops, best of 3: 846 ns per loop
 sage: %timeit subcat_hook(R,C)
 625 loops, best of 3: 816 ns per loop
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13400#comment:7>
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