#15367: Empty lists while creating parents
-------------------------------------+-------------------------------------
Reporter: roed | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.13
Component: coercion | Resolution:
Keywords: | Merged in:
Authors: Nils Bruin | Reviewers: Simon King
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/nbruin/ticket/15367 | 719cdec176875685142039dce297a7fd8ae4143b
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Third step: Re-test timings. I do "branch versus sage-5.13.b4".
{{{
%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]
""")
}}}
In the branch:
{{{
sage: T = sage.structure.coerce_dict.TripleDict(11)
sage: L1 = srange(100)
sage: %time test(T,L1,L1,L1,ZZ)
CPU times: user 9.70 s, sys: 0.05 s, total: 9.75 s
Wall time: 9.77 s
sage: %time test2(T,L1,L1,L1)
CPU times: user 0.64 s, sys: 0.01 s, total: 0.65 s
Wall time: 0.66 s
sage: %time test3(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 test4(T,L1,L1,L1)
CPU times: user 0.23 s, sys: 0.00 s, total: 0.23 s
Wall time: 0.23 s
sage: %time test5(T,L1,L1,L1)
CPU times: user 0.84 s, sys: 0.01 s, total: 0.85 s
Wall time: 0.86 s
sage: get_memory_usage()
231.640625
}}}
In sage-5.13.b4 (plus #14912, but this doesn't touch coerce dict):
{{{
sage: T = sage.structure.coerce_dict.TripleDict(11)
sage: L1 = srange(100)
sage: %time test(T,L1,L1,L1,ZZ)
CPU times: user 15.94 s, sys: 0.11 s, total: 16.05 s
Wall time: 16.08 s
sage: %time test2(T,L1,L1,L1)
CPU times: user 1.86 s, sys: 0.00 s, total: 1.86 s
Wall time: 1.87 s
sage: %time test3(T,L1,L1,L1)
CPU times: user 1.86 s, sys: 0.00 s, total: 1.86 s
Wall time: 1.86 s
sage: %time test4(T,L1,L1,L1)
CPU times: user 1.79 s, sys: 0.02 s, total: 1.81 s
Wall time: 1.82 s
sage: %time test5(T,L1,L1,L1)
CPU times: user 1.72 s, sys: 0.03 s, total: 1.75 s
Wall time: 1.75 s
sage: get_memory_usage()
318.078125
}}}
So, everything became faster, and the memory consumption is a bit less
(but the latter could very well be because of other tickets).
The effect on startuptime is probably not significant, but I get (one run
only) `1586.843ms` with the branch versus `1600.406ms` with
5.13.b4+#14912.
So, the winner is: THIS BRANCH.
Last step of the review: Read the new code.
--
Ticket URL: <http://trac.sagemath.org/ticket/15367#comment:54>
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.