Re: Speedup insert into treestore



Hi,

On Sun, 2005-10-09 at 17:13 +0200, Florian Schaefer wrote:
Hello everyone,

I have got a treeview that displays a sorted treestore. Now I need to
repopulate its content with say about 500 columns which takes ages here
(that is about 2 seconds on a PIII 1GHz).

Is there a way to make this quicker?

I've read about two possibilities: (1) To detach the treestore from the
view before doing any big changes and (2) to disable sorting during this
operation.

Strategy 1) is always the best one when updating the contents of a
TreeModel implementation; the TreeView is constantly listening for
changes in the model - so disconnecting it yields the better results.

Sadly, I don't know how to do either of those options (set_sort_column_id
does not accept undef).

Disabling sorting is done by passing -1 as the column id.

 Furthermore I don't know if (1) would really help
me, as the gtk main loop should not be called during my update run.

Try it: you would be surprised of how many times the Gtk main loop gets
executed when we think it shouldn't be. ;-)

If this doesn't work, then there are other ways of improving the
performances of your code, e.g. populating the child nodes only when the
parent is expanded, or setting the height of the cell renderers as fixed
if you know that you'll always display your data with the same format.

Ciao,
 Emmanuele.

-- 
Emmanuele Bassi - <ebassi gmail com>
Log: http://log.emmanuelebassi.net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]