[MERGE] Add an InventoryEntry cache for xml deserialization

John Arbash Meinel john at arbash-meinel.com
Thu Dec 11 00:23:05 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> I was just wondering when reading about this if there'd be any value
> putting items expired from the cache into a weakref, so they have a
> chance of still being retained.  Or did we look into this before and
> find that they were destroyed immediately anyhow?
> 

If I was to do this I would probably just switch entirely to a
WeakValueDictionary.

The CPython garbage collector is deterministic if you don't have cycles.
Though in these cases it will still be referenced by whatever other
Inventory was recently deserialised.

I'm not sure about the overhead of a WeakValueDictionary versus a normal
 dictionary. Certainly a weakref object has at least a function-call
overhead to evaluate whether the object still exists or not. (It may not
be a large overhead.)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklAXWkACgkQJdeBCYSNAAMgaQCgo1ShLKsAja6Uh/fTv/hzJqUo
jCUAn1n/hz5jwmQF7t7rGXamILkmGiTj
=RdFI
-----END PGP SIGNATURE-----



More information about the bazaar mailing list