#11521: Use weak references to cache homsets
--------------------------------------------------+-------------------------
       Reporter:  jpflori                         |         Owner:  robertwb    
                 
           Type:  defect                          |        Status:  
positive_review              
       Priority:  major                           |     Milestone:  sage-5.4    
                 
      Component:  coercion                        |    Resolution:              
                 
       Keywords:  sd35                            |   Work issues:              
                 
Report Upstream:  N/A                             |     Reviewers:  Jean-Pierre 
Flori, Nils Bruin
        Authors:  Simon King                      |     Merged in:              
                 
   Dependencies:  #12969; to be merged with #715  |      Stopgaps:              
                 
--------------------------------------------------+-------------------------

Comment (by jpflori):

 Replying to [comment:155 nbruin]:
 relevance to that case. Once a coercion `h: X -> Y` is discovered, a
 strong reference to `h` is stored in `self._coerce_from_hash`. Since `h`
 stores a strong reference to `X` we now have ensured that the life time of
 `X` is bounded below by the life time of `Y`. So the weak caching there
 only helps for `X` that do not coerce into `Y`.
 >
 > How eagerly does the system use the `self._convert_from_hash`? It is
 quite likely that even with #12313 in place,
 > {{{#!python
 > for p in prime_range(1,1000):
 >     k=GF(p)
 >     a=k(1)
 >     b=ZZ(a)
 > }}}
 I see the problem.
 Another solution may be to use TripleDicts there as well rather than
 MonoDicts.
 Or DuoDicts!

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