[pygtk] push huge array into liststore
Cornelius Kölbel
cornelius.koelbel at lsexperts.de
Mon Jul 12 23:48:08 WST 2010
Dear list,
I got an array of dictionaries, that I want to add to a GTKListStore,
that is displayed an a treeview.
This is very slow. I already replaced the liststore.append by
liststore.insert, which is much much faster.
But still, filling the 10.000 values takes about 50 seconds.
Is there any cool mapping function, to push the array to the liststore?
I used a for loop to iterate over the array...
I also tried while an to pop the array elements...
It is something like this:
data: array of dictionaries
data = array( { 'v1' : 'something', 'v2': 'something else' } ,
{ 'v1' : 'another', 'v2': 'something completely diff' }
)
for d in data:
self.liststore.insert( 0, ( d.get("v1"), d.get("v2") ....))
...is there a better way than doing a for loop?
...or a way to not have to interate over the 10.000 dicts?
...or is there a cool reading on performance tuning pyton?
Kind regards
Cornelius
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20100712/380e3f60/attachment.pgp
More information about the pygtk
mailing list