#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:
-------------------------------------+-------------------------------------
Changes (by SimonKing):
* work_issues: => Improve timings
Comment:
I have good and bad news. The good news first.
Repeating the tests from comment:4, with the attached branch:
{{{
sage: from sage.structure.coerce_dict import MonoDict
sage: memus= get_memory_usage()
sage: L=[MonoDict(23) for i in xrange(2*10^5)]
sage: print get_memory_usage(memus)
54.984375
sage: memus= get_memory_usage()
sage: L2=[MonoDict(53) for i in xrange(2*10^5)]
sage: print get_memory_usage(memus)
55.2109375
sage: memus= get_memory_usage()
sage: L3=[sage.structure.coerce_dict.TripleDict(23) for i in
xrange(2*10^5)]
sage: print get_memory_usage(memus)
79.83203125
sage: memus= get_memory_usage()
sage: L4=[sage.structure.coerce_dict.TripleDict(11) for i in
xrange(2*10^5)]
sage: print get_memory_usage(memus)
79.5429687500000
}}}
So, that's much of a progress.
More good news. I compare sage-5.12.beta5+#13394 with the branch from
here. First, without the branch:
{{{
sage: %time _=[sage.structure.coerce_dict.TripleDict(11) for i in
xrange(2*10^5)]
CPU times: user 2.50 s, sys: 0.12 s, total: 2.61 s
Wall time: 2.62 s
sage: %time _=[sage.structure.coerce_dict.TripleDict(23) for i in
xrange(2*10^5)]
CPU times: user 4.04 s, sys: 0.16 s, total: 4.21 s
Wall time: 4.21 s
sage: %time _=[sage.structure.coerce_dict.TripleDict(53) for i in
xrange(2*10^5)]
CPU times: user 6.10 s, sys: 0.27 s, total: 6.36 s
Wall time: 6.38 s
}}}
With the branch:
{{{
sage: %time _=[sage.structure.coerce_dict.TripleDict(11) for i in
xrange(2*10^5)]
CPU times: user 2.48 s, sys: 0.10 s, total: 2.57 s
Wall time: 2.59 s
sage: %time _=[sage.structure.coerce_dict.TripleDict(23) for i in
xrange(2*10^5)]
CPU times: user 2.19 s, sys: 0.07 s, total: 2.26 s
Wall time: 2.27 s
sage: %time _=[sage.structure.coerce_dict.TripleDict(53) for i in
xrange(2*10^5)]
CPU times: user 2.51 s, sys: 0.02 s, total: 2.53 s
Wall time: 2.53 s
}}}
Thus, it is a clear progress, for larger empty dictionaries.
Now for the bad news. I am testing how efficient it is to fill an empty
`TripleDict`, triggering many resizes, and reading and deleting items.
First, without the branch:
{{{
sage: cython("""
....: def test(T, list L, v):
....: for i in L:
....: for j in L:
....: for k in L:
....: T[i,j,k] = v
....: """)
....:
sage: T = sage.structure.coerce_dict.TripleDict(11)
sage: L = srange(100)
sage: %time test(T, L, ZZ)
CPU times: user 15.23 s, sys: 0.28 s, total: 15.51 s
Wall time: 15.54 s
sage: cython("""
....: def test2(T, list L):
....: for i in L:
....: for j in L:
....: for k in L:
....: v = T[i,j,k]
....: del T[i,j,k]
....: """)
....:
sage: %time test2(T, L)
CPU times: user 2.74 s, sys: 0.06 s, total: 2.81 s
Wall time: 2.81 s
}}}
Now, the same with the branch:
{{{
sage: T = sage.structure.coerce_dict.TripleDict(11)
sage: L = srange(100)
sage: %time test(T, L, ZZ)
CPU times: user 131.21 s, sys: 1.36 s, total: 132.57 s
Wall time: 133.11 s
sage: %time test2(T, L)
CPU times: user 46.98 s, sys: 0.58 s, total: 47.56 s
Wall time: 47.97 s
}}}
'''__Conclusion__'''
The memory footprint and the creation time of an empty dictionary did
considerably improve. However, the timings for setting, getting and
deleting items became very very bad. These operations are of vital
importance for the coercion framework, and hence this needs to be fixed.
--
Ticket URL: <http://trac.sagemath.org/ticket/15367#comment:21>
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.