StaticTuple... naming, maintenance, ...

John Arbash Meinel john at arbash-meinel.com
Tue Oct 6 01:39:45 BST 2009


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

Andrew Bennetts wrote:
> John Arbash Meinel wrote:
> [...]
>> 3) I also implemented a custom 'Interner' class, that works basically
>>    like a PySet, but allows lookup and uses half the memory. (1/3rd
>>    the memory of a dict.)
>>
>>    (In loading all of launchpad, 24MB was used for just the dict holding
>>     the interned keys. So I save 16MB just with that.)
> 
> Do you keep weak references to interned items?  Or is that not worth the memory
> and effort?
> 
> -Andrew.

I don't. Adding a weakref slot costs another pointer per object, and
then whatever object allocation overhead it is for the weakref list.

However, they are in a structure that saves them as long as they are
referenced (just like strings, when the last ref goes away, they remove
themselves.)

John
=:->

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

iEYEARECAAYFAkrKkdEACgkQJdeBCYSNAAP9ygCgs/oG4bqJOfN9XMT7jfzBv4hN
rlkAoKYsgN5XnMdgm4ZQSrH6rfS4C6z6
=fvti
-----END PGP SIGNATURE-----



More information about the bazaar mailing list