Re: decrease DictRow memory usage

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization initd.org
Message-ID <1241515983.14409.1.camel@erin>
Il giorno lun, 04/05/2009 alle 16.22 +0300, Marko Kreen ha scritto:
> Use "__slots__ = ('_index',)" to reserve single attribute slot for
> _index.
> Otherwise a per-row dict is created to store object attributes...
> 
> The only danger of doing it is that if somebody uses plain DictRow and
> adds new attrubutes into it, it will get error:
> 
>   row.foo = x
> 
> I'm really dubious if anybody does this.  NB, this does not apply if
> somebody has subclassed DictRow, then the parent class' __slots__
> is ignored.

I agree. I someone uses custom attributes on the DictRow let me know or
I'll apply the patch. ;)

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           fog-NGVKUo/i/[email protected]
  Spesso crescere ed andare a vivere da soli è l'unico modo di restare
   bambini.                                             -- Alice Fontana

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkoAB8oACgkQvcCgrgZGjet4MACfU4anpPlU4Yj92pluXWYHZdTd
2WwAoIh9vuXeQZ4vXAi51aBmAwI65evD
=OVmS
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.