#13394: Write a WeakValueDictionary with safer key removal
-------------------------------+-------------------------
       Reporter:  nbruin       |        Owner:  rlm
           Type:  enhancement  |       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):

 Excellent work! I like how you found a way to reuse python dictionaries. I
 think there is one fairly easy optimization that you can make that is
 fairly similar to how we ended up implementing the buckets for !MonoDict
 and !TripleDict: Presently, your bucket is a list of tuples. That provides
 an extra layer of indirection, meaning both slower access and more memory
 use and allocation.

 If instead you "inline" the tuples by making the bucket a list with the
 layout `[key1, weakref_to_value1, key2, weakref_to_value2,...]` you can
 save yourself some overhead. Normally these lists should only contain one
 key-value pair anyway.

 It may be worth browsing through !MonoDict anyway. There may more more
 little tricks that we used there that may apply here and that I don't
 remember right now.

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