#15367: Empty lists while creating parents
-------------------------------------+-------------------------------------
       Reporter:  roed               |        Owner:
           Type:  defect             |       Status:  new
       Priority:  major              |    Milestone:  sage-5.13
      Component:  memleak            |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Nils Bruin         |    Reviewers:  Simon King
Report Upstream:  N/A                |  Work issues:  Improve timings
         Branch:                     |       Commit:
  u/SimonKing/ticket/15367           |  a2852e9610a76e6df392544b01b8e3c319b1cdd4
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by nbruin):

 To compare, with the new hash function we get for the script
 {{{
 %cpaste
 cython("""
 def test(T, list L1, list L2, list L3, v):
     for i in L1:
         for j in L2:
             for k in L3:
                 T[i,j,k] = v
 def test2(T, list L1, list L2, list L3):
     for i in L1:
         for j in L2:
             for k in L3:
                 v = T[i,j,k]
 def test3(T, list L1, list L2, list L3):
     for i in L1:
         for j in L2:
             for k in L3:
                 (i,j,k) in T
 def test4(T, list L1, list L2, list L3):
     for i in L1:
         for j in L2:
             for k in L3:
                 (i,j+1,k) in T
 def test5(T, list L1, list L2, list L3):
     for i in L1:
         for j in L2:
             for k in L3:
                 del T[i,j,k]
 """)
 T = sage.structure.coerce_dict.TripleDict(11)
 L1 = srange(100)
 }}}
 With vanilla 5.10:
 {{{
 sage: %time test(T,L1,L1,L1,ZZ);
 CPU times: user 6.61 s, sys: 0.08 s, total: 6.69 s
 Wall time: 6.72 s
 sage: %time test2(T,L1,L1,L1);
 CPU times: user 0.82 s, sys: 0.00 s, total: 0.82 s
 Wall time: 0.83 s
 sage: %time test3(T,L1,L1,L1);
 CPU times: user 0.83 s, sys: 0.00 s, total: 0.83 s
 Wall time: 0.83 s
 sage: %time test4(T,L1,L1,L1);
 CPU times: user 0.68 s, sys: 0.00 s, total: 0.68 s
 Wall time: 0.68 s
 sage: %time test5(T,L1,L1,L1);
 CPU times: user 0.81 s, sys: 0.00 s, total: 0.81 s
 Wall time: 0.81 s
 }}}
 On 5.13beta(something) with the patch:
 {{{
 sage: %time test(T,L1,L1,L1,ZZ);
 CPU times: user 3.28 s, sys: 0.06 s, total: 3.34 s
 Wall time: 3.35 s
 sage: %time test2(T,L1,L1,L1);
 CPU times: user 0.61 s, sys: 0.00 s, total: 0.61 s
 Wall time: 0.61 s
 sage: %time test3(T,L1,L1,L1);
 CPU times: user 0.54 s, sys: 0.00 s, total: 0.54 s
 Wall time: 0.54 s
 sage: %time test4(T,L1,L1,L1);
 CPU times: user 0.08 s, sys: 0.00 s, total: 0.08 s
 Wall time: 0.08 s
 sage: %time test5(T,L1,L1,L1);
 CPU times: user 0.28 s, sys: 0.00 s, total: 0.28 s
 Wall time: 0.29 s
 }}}
 so creation, finding elements not in there, and deletion is very much
 faster and retrieving elements is quite a bit faster. It seems like a win
 to me (plus: #15069 issues should now be properly fixed in most
 situations, thanks to a borrowed trashcan--but we could use that in the
 other design too)

--
Ticket URL: <http://trac.sagemath.org/ticket/15367#comment:29>
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to