#5970: Weak references in Polynomial Ring cache
--------------------------------------------+-------------------------------
   Reporter:  SimonKing                     |       Owner:  malb                
                
       Type:  defect                        |      Status:  needs_info          
                
   Priority:  critical                      |   Milestone:  sage-4.3.3          
                
  Component:  commutative algebra           |    Keywords:  polynomial ring 
cache weak reference
     Author:                                |    Upstream:  N/A                 
                
   Reviewer:                                |      Merged:                      
                
Work_issues:  regression for test_ec_leak?  |  
--------------------------------------------+-------------------------------

Comment(by malb):

 First, I can reproduce your results:

 '''without patch'''
 {{{
 #!python
 sage: %time test_poly_leak(10^5)
 CPU times: user 11.11 s, sys: 0.31 s, total: 11.43 s
 Wall time: 11.84 s
 311.71875
 sage: %time test_ec_leak(10^5)
 CPU times: user 46.12 s, sys: 0.27 s, total: 46.39 s
 Wall time: 47.27 s
 206.26953125
 sage: %time test_pc_leak(10^5)
 CPU times: user 16.95 s, sys: 0.08 s, total: 17.03 s
 Wall time: 17.64 s
 54.1328125
 }}}

 '''with patch'''
 {{{
 #!python
 sage: %time test_poly_leak(10^5)
 CPU times: user 9.14 s, sys: 0.10 s, total: 9.25 s
 Wall time: 9.58 s
 70.53125
 sage: %time test_ec_leak(10^5)
 CPU times: user 57.96 s, sys: 0.50 s, total: 58.46 s
 Wall time: 59.63 s
 452.3671875
 sage: %time test_pc_leak(10^5)
 CPU times: user 17.03 s, sys: 0.07 s, total: 17.10 s
 Wall time: 17.53 s
 54.23046875
 }}}

 I would assume this is due to the fact that the elliptic curve constructor
 does its own hashing somewhere (someone more familiar with this area might
 want to comment on that) which prevents the GC from collecting the unused
 polynomial rings. Also, since weak references need to keep track of more
 information I find it plausible that each weak reference has some memory
 overhead. Since we cannot free the unused polynomial rings this overhead
 accumulates.

 Maybe the elliptic curve constructor should use weak references as well?

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