#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: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------+-------------------------
Comment (by nbruin):
After figuring out how python dicts work to improve WeakValueDictionary it
wasn't so complicated to replicate the design for MonoDict and TripleDict
either. Things of note:
- I tried to be drop-in compatible. I haven't run doctests yet, but
adapting should be straightforward
- Performance is noticeably better than the previous implementation.
Given how much overhead a per-line `timeit` has due to the python
interpreter, I expect that this means the performance is considerably
better (but in applications it probably doesn't matter that much, since
our previous implementation was already pretty good)
- regular deletions are done by placing the items to be deleted in a list
(yes, that means allocating a list, but weakref callbacks etc. are allowed
memory allocations. It would be virtually impossible to write python
interpreter code that doesn't do that) and then throwing away the list.
Advantage: we borrow python's trashcan that's already implemented for
container types like lists. Of course there's the slight disadvantage of
having some memory allocation activity, but that should be pretty fast
(every python function call involves constructing tuples etc.)
- storage should be much more compact, which should make code more cache-
friendly as well. We don't have per-bucket overhead anymore: open
addressing shares all space.
- design size are irrelevant: the table is just a power of 2, but we use
different hashing, so we should still get a good spread.
Some little problems:
- rolling your own dynamically allocated store for python object links
means that cython's generated GC traverse and clear code isn't sufficient.
I wrote my own and hack them into the right slots.
- we need to do some extensive testing to check no silly mistakes are
left.
--
Ticket URL: <http://trac.sagemath.org/ticket/15367#comment:13>
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.