Re: speeding up GtkTreeView?



On Wed, Feb 12, 2003 at 12:19:58PM +0100, Filip Van Raemdonck wrote:

I think it would be very useful for the two standard treemodel
implementations to have an API to put in a custom underlying datamodel.
Right now those default models are really only useful with small data
sets. Anything serious brings them to their knees.


Isn't this why GtkTreeModel is an interface. Simply create a wrapper
around anyother data structure (or create values on the fly) that
implements the GtkTreeModel interface.

I have done this with PyGTK, and it is a cinch.

I have not actually done this in C, but from the looks of gtktreestore.c
it doesn't look much worse than any other GObject boilerplate code.

Before doing that however, it might be useful to profile the treestore
code. The GtkTreeStore uses the glib n-ary tree implementation for the
underlying data storage. That data structure should certainly not
exhibit worse than O(1) insert performance (its straightforward linked
lists with a parent/children links), so I think there might be
some other hot spot in the gtktreestore.c code if it is really
exhibiting worse than O(1) performance on inserts. 
There is some "path" finding code that makes recursive function calls up 
to the root on every append operation. So inserting a child to a node is
an O(n) operation where n is the distance to the root. 
You will take a hit if your tree height (data structure-wise) is very large.


 --jkl



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