Re: GtkTreeView very slow for large lists



On 16 December 2011 10:36,  <jcupitt gmail com> wrote:
2011/12/16 John Lindgren <john lindgren aol com>:
Lately I have been trying to improve the performance with large
playlists (i.e. on the order of 100,000 entries).  The one remaining
problem spot seems to be GtkTreeView.  I am attaching a simple test
program that creates a GtkTreeView with 3 columns and 100,000 rows.
With GTK+ 3.2.2, the program uses 29 seconds of CPU time before reaching
idle, on a 2 GHz Core 2 Duo.  (GTK+ 2.24.8 is considerably better, at 10
seconds, but still too slow for practical use.)  Is there any way that
GtkTreeView can be made usable for such long lists?

I remember when the treeview system was being built one of the aims
was to make it (fairly) easy to write your own model.

I'm so sorry, I hadn't actually read your code, I now see you're
already doing exactly this.

I did notice that you forgot to put the treeview into fixed-height mode.

Normally, treeview lets rows vary in height (so you can change font
between rows, for example). To make this work, treeview has a idle
task which scans the entire model after it's been realized and
calculates a total height for the view, updating an initial guess.
This is the thing that's causing your terrible performance problems.

On my elderly desktop I see your test window almost immediately, but
it takes 50s for the CPU to drop to zero as it requests the height of
every row. If i add this line after creating the columns:

    gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (list), TRUE);

The window appears instantly and there is no background CPU churn.

John



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