[Lazarus] testing virtual TListView in gtk2

zeljko zeljko at holobit.net
Wed Dec 2 08:46:47 CET 2009


On Wednesday 02 December 2009 04:53, Paul Ishenin wrote:
> Andrew Haines wrote:
> > I did a small test loading a text file with 50,000+ lines with my custom
> > model and the GtkTreeView retrieved the value of each item in the list
> > on startup. I assume it's to calculate the size for the scrollbar since
> > the height of the listitems is not fixed but can vary per row in the
> > GtkTreeView.
> >
> > Would this help virtual treeview in any way?
>
> For virtual listview it is not needed to store any items anywhere - we
> only need to tell to treeview that we have 50,000+ items and return
> correct listitem when it is requested by index. Yes, it would help to
> store less data.
>
> At the moment data is stored:
> - our own structure which we want to represent in the listview
> - gtk list model items - we are storing there 50,000+ items * 3
> (checkbox, glyph, index) = 50,000+ * 9+ bytes = 450,000++ bytes
>
> If we can remove gtk list then we of course save some memory.

I've already maded small tests with qt. Yes, it creates all items via 
setItemCount() like gtk do, but it does not need to be se in OwnerData=True 
mode.I've created TFPList via setItemCount(), and then create 
QTreeWidgetItems's only when painting virtual list (create only items for 
visible rows).This way needs a lot less memory , but need some more cpu 
cycles while creating visible items...




More information about the Lazarus mailing list