Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Poor tree performance

Status
Not open for further replies.

lewisp

Programmer
Aug 5, 2001
1,238
GB
I am using forms 6i v6.0.8.12.1 and I am running my form on local client under Windows XP and 98.

I have created a tree item in the form and I populate the tree at run time. The tree can contain around 5000 elements. The problem I have is that the tree performance degrades very badly as more elements are added. Is this to be expected?

By performance, I mean a simple loop of all selected elements of the tree using

FOR c IN 1..To_Number(Ftree.Get_Tree_Property('TREE_BLOCK.TREE',Ftree.SELECTION_COUNT))

takes a very long time, even if only a few elements are selected. Is there any way I can improve the performance, short of upgrading my PC to a 3.5GHZ processor?
 
The normal way for this case is to populate tree dinamycally, while expanding it. You may query childs one step ahead to set the node state correctly or just changin it on expanding. Regards, Dima
 
Thanks Sem.

I think I've found the answer anyway. I was using a function to tree walk from the selected node which I called with this:

l_tot_in_tree := Fn_Count(Ftree.Get_Tree_Selection('block.TREE',1),TRUE);

The recursive function looked like this:

FUNCTION Fn_Count (p_node IN Ftree.NODE,
p_parent IN BOOLEAN DEFAULT FALSE)
RETURN NUMBER IS
l_child Ftree.NODE;
l_parent BOOLEAN := FALSE;
l_count NUMBER := 0;
BEGIN
IF NOT Fn_Is_Node_Selected(p_node)
OR p_parent
THEN
l_count := l_count + 1;
l_parent := TRUE;
END IF;
--
IF l_parent
THEN
l_child := Ftree.Find_Tree_Node('block.TREE','');
--
WHILE NOT Ftree.ID_NULL(l_child)
LOOP
IF Ftree.Get_Tree_Node_Parent('block.TREE',l_child) = p_node
THEN
l_count := l_count + Fn_Count(l_child);
END IF;
--
l_child := Ftree.Find_Tree_Node('block.TREE',NULL,start_point=>l_child);
END LOOP;
END IF;
--
Return l_count;
END Fn_Count;


Of course, the obvious error was the line

l_child := Ftree.Find_Tree_Node('block.TREE','');

and it should actually be

l_child := p_node;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top