#14058: Weakly reference binary operation codomains
-----------------------------------+----------------------------------------
       Reporter:  robertwb         |         Owner:  rlm         
           Type:  enhancement      |        Status:  needs_review
       Priority:  major            |     Milestone:  sage-5.7    
      Component:  memleak          |    Resolution:              
       Keywords:                   |   Work issues:              
Report Upstream:  N/A              |     Reviewers:              
        Authors:  Robert Bradshaw  |     Merged in:              
   Dependencies:  #12313           |      Stopgaps:              
-----------------------------------+----------------------------------------

Comment (by SimonKing):

 By the way, it seems that the "insufficient" caching (not enough to keep
 C() alive) has no influence on performance, at least not if computations
 are done in a close cycle:
 {{{
 sage: %attach /home/simon/SAGE/work/memleak/testcoercion.py
 sage: OA = A()
 sage: OB = B()
 sage: a = OA(1)
 sage: b = OB(1)
 sage: def test(x,y):
 ....:     for _ in xrange(2*10^5):
 ....:         z = x*y
 ....:
 sage: %time test(a,a)
 CPU times: user 4.49 s, sys: 0.00 s, total: 4.49 s
 Wall time: 4.49 s
 sage: %time test(a,b)
 CPU times: user 8.99 s, sys: 0.11 s, total: 9.11 s
 Wall time: 9.13 s
 sage: c = a*b
 sage: print c.parent()
 C
 sage: %time test(a,b)
 CPU times: user 8.85 s, sys: 0.03 s, total: 8.88 s
 Wall time: 8.89 s
 }}}

 In the first run of test(a,b), there is the possibility that `parent(a*b)`
 becomes created repeatedly, as I have demonstrated above. In the second
 run, `parent(a*b)` is kept alive, by keeping a pointer to the result of
 `a*b`. There is no significant difference in performance. Of course, we
 also see that multiplication within one parent is faster.

 Is there a way to get the patchbots report significant regressions in some
 examples? Because I am sure that some parts of Sage (schemes and combinat
 are typical candidates) rely on a strong coercion cache.

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