Re: decrease DictRow memory usage

Oswaldo Hernández <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Federico Di Gregorio escribió:
> 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. ;)
> 

Hi,

I use a custom DictRow class derived from extras.DictRow. I will do this afternoon some tests to 
overload '__slots__'.

I will put here the results tomorrow.


-- 
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************
PD:
Antes de imprimir este mensaje, asegúrese de que es necesario.
El medio ambiente está en nuestra mano.
_______________________________________________
Psycopg mailing list
[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
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.