Re: Slow treemodel loading



Jeffrey Barish wrote:
Damien Caliste wrote:

Hello,

If I'm not wrong, you may be interested with
gtk-list-store-insert-with-values() function:

http://library.gnome.org/devel/gtk/unstable/GtkListStore.html#gtk-list-store-insert-with-values

Thank you for your suggestion.  The documentation is characteristically
ambiguous, so I can't tell whether this function would solve the problem. The documentation says that the function does not emit the rows_reordered
signal, but it does not say that the list store is not resorted.  Perhaps
suppressing the rows_reordered signal also suppresses sorting, but I don't
find that crucial detail documented anywhere.  In any case,
insert_with_values does not appear to be available in PyGTK, which is what
I am actually using.

This problem with list stores seems serious to me, so I am surprised that
Gtk suffers from it.

a) hide the widget that displays the list store
b) populate
c) show the display widget.

I have encountered this exact same problem in an application I am developing. Unless you are dealing with more than 200,000 rows or so, the sort time is negligible compared to the amount of time to do the computations required to determine what is visible and update the display every time you insert a new row. My current application deals with about 103,000 rows - and the difference was easily 2 orders of magnitude.

I use a progress bar on the bottom of the window in question to display the progress bar so that the user (me) doesn't freak when the display seems to "freeze".

Another alternative would be to change the sort column of your tree to a column that does not have a sort function associated with it. In that case, you set the column, populate, reset the column, and away you go - the sort would only be done once at the end, instead of every time you add a row.

Hope something here helps.



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