filling Tree Control is slow

Started by honkinberry, January 25, 2011, 10:11:36 AM

Previous topic - Next topic

honkinberry

I have a Tree List control that is taking too long to fill the members.

In the default installation, there are about 50 parent elements, with 700 child elements in up to 4 levels of hierarchy.
In that case, it takes about 3 seconds to populate the tree list.
Yet we are getting power users who have had the software for over 5 years now, and they can have upwards of 5,000 child elements, in which case it is taking closer to 7 seconds to populate the tree list.

So before I rewrite the rather involved requery function, I am inquiring if you know if I will be able to get the speed improvement I am after.  Essentially, I'm wondering if instead of passing each item one at at time, if I pass all the parent elements as a list of lists to a single dcl_tree_AddParent call, and then only have the 50 or so calls to dcl_tree_AddChild, again with the list of lists -- will that see a performance gain from calling them individually?
Or, of course, if you happen to know if the performance hit is from the tree list control itself rather than the dcl_tree function calling, then I would instead need to go the far more involved route of adding the child members on the fly from the Expand event.
In either case, I've got my work cut out for me, so I thought I'd ask for your thoughts first.

Many thanks for any pointers!

--J

honkinberry

I was able to do a rather quick and dirty test.
I kept the 50 add_parent calls as single calls, but then assembled the 700 add_child calls into 50 add_child calls.
The result was negligible, if any.

Any other tips, tricks, or thoughts on filling a tree list would be most appreciated!

cheers,

--J

Kerry


How much of your stated time is involved with determining the data ?

Are you adding graphics to the lists ?

Perfection is not optional.
My other home is TheSwamp

honkinberry

No graphics.
The data is all read into two lists initially, so all processing of the data is done on the lists.
That made me think of another test, so I simply commented out all the AddChild lines of code, which resulted in a negligible hit.
So it does seem that no matter how I requery the treelist, the primary performance hit is in processing all the data, with the AddChild calls actually the speediest part.
Well now I feel like a sucker!
Thanks for prodding me in the right direction.

--J