Re: speeding up GtkTreeView?



On Mon, Feb 17, 2003 at 09:39:06AM +0100, Olaf Fr±czyk wrote:
On Sat, 2003-02-15 at 01:48, Havoc Pennington wrote:
 - you can avoid TreeStore/ListStore entirely and do your 
   own object providing a GtkTreeModel interface
Is there some tutorial how to do it?
 - you can have a single-column TreeStore/ListStore where the 
   column contains a single void* pointing to a custom struct
   (gtk-demo has an example here I believe)

GtkListStore is a linked list, and if you set a string on it for
example it's going to copy the string. So if you stuff copy 8 strings
per row into a giant linked list, it is not going to be fast.

Could you explain the difference between storing data by GtkListStore
and GtkCList?

There are several reasons why CList is different, among them:

 - it assumes fixed-height rows and columns (TreeView has a mode for
   this, though I'm not sure TreeView always takes advantage of it as
   much as it could).

 - it hardcodes the data structure to a linked list instead of making
   it pluggable, so it can iterate over it a good bit more quickly
   without function call or iterator overhead, but you can't write 
   a custom model.

 - CList doesn't have many of the features such as different kinds of 
   cell renderer.

And a hint how to make GtkTree* being as fast as GTkCList.


You have to think about it a little bit, it depends on what you are
doing and why what you are doing is slow.

As I said two possible speedups if your slow code is stuffing lots of
data into ListStore: storing a custom struct in the ListStore, and
writing a custom model.

Not to say there aren't improvements possible to TreeView itself, but
also I think many people are doing things that are not efficient.

I would suggest profiling as a way to see what's going on.

Havoc



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