Il giorno lun, 12/07/2010 alle 17.48 +0200, Cornelius Kölbel ha scritto: > 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?
I really don't know, but... already read http://faq.pygtk.org/index.py?req=show&file=faq13.043.htp ? Pietro _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/