Re: GtkTreeView very slow for large lists



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.

The idea was that, if your application required it, you could swap the
generic default models for something which linked the view directly to
your program's internal state. For example, a database view could have
a custom model which pretended to have 100m rows and which fetched
chunks of 100 rows at a time from the database as required by the view
as it scrolled. The user would have the illusion of being able to
scroll freely though a huge dataset without having to build a massive
data structure in memory.

You obviously have to turn off auto row and column sizing, since it's
not going to be possible for the treeview to walk the model and
calculate sizes for you. I suppose sorting by column and filtering by
content could work if your index is good enough.

I've never tried implementing a custom model myself and I don't know
if this aim was realized in the final code, but that was one of the
ideas. Google suggests this link, I don't know whether it's any good
though.

http://en.wikibooks.org/wiki/GTK%2B_By_Example/Tree_View/Custom_Models

John



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