LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree control creation is too slow

Hi,
I want to display more than 10000 elements in tree control in 3 levels. After lot of trials I found one example in NI Discussion Forum. Using this example I created vi that is close to my needs, but time of building of this tree is very long. It takes more than 4 min. How can I speed up this process? Please let me know your ideas. I use LV8.
 
Best Regards
Wacek
0 Kudos
Message 1 of 18
(4,729 Views)

Hi Wacek,

There are two things you can do to speed this up.  One is to use the "Defer Panel Updates" property of the Panel to turn off updating of the panel until the entire tree is populated.  After the tree is populated, you would then disable Defer Panel Updates.  This is a property of the Panel class, so you can search the LabVIEW Help for "Defer Panel Updates" to learn more.  It basically involves putting a property node before and after your tree population code.

Another thing you can do is add all the tags to your tree at once with the "Add Multiple Items to End" method of the tree control.  This is a new method for the Tree in LabVIEW 8.0, and my understanding is that it is much, much faster at adding items to a tree than doing it one at a time.  Again, check the LabVIEW Help for more information about this method.

Hope this helps,

-D

Message 2 of 18
(4,728 Views)
Thank you Darren for quick answer. The "Defer Panel Updates" property reduced the tree population time about 0.5 minute. So it is still above 3 min - too long.
I tried
the "Add Multiple Items to End" method but without success. I can not find any example with this method. Also in  LabVIEW Help is not enough info about it .


Wacek
0 Kudos
Message 3 of 18
(4,715 Views)
Hi Wacek,
 
I just tried writing a VI with the new "Add Multiple Items to End" method and it seemed straightforward enough, although I do agree that the Help is a bit lacking for someone who is brand new to using the Tree Control.  I have attached a sample VI to this e-mail, but it seems the key to using this VI is constructing your array of tag clusters to add to the tree, and making sure you get the "Item Indent" value set properly for each tag.
 
Hope this helps,
-D
Message 4 of 18
(4,712 Views)
Darren,
Your example was simple but very helpfull for me. I will check how it works with my data. 
Now most of computer resources is used for preparation of data, but it shouldn't be problem for SQL server :).

Wacek
0 Kudos
Message 5 of 18
(4,694 Views)


@Wacek wrote:
Thank you Darren for quick answer. The "Defer Panel Updates" property reduced the tree population time about 0.5 minute. So it is still above 3 min - too long.
I tried
the "Add Multiple Items to End" method but without success. I can not find any example with this method. Also in  LabVIEW Help is not enough info about it .


Wacek


This doesn't sound right at all. When updating a Tree control without defer panel update enabled you spend a large amount of your time in redrawing the tree control. So using defer panel update should definitely get you more time savings. However there is of course another time delay here if you seem to use an SQL database to get the values. SQL queries can get very slow if not down with paramtrized queries or such, so you might want to look at that part as well.

Rolf Kalbermatter
Rolf Kalbermatter
Averna BV
0 Kudos
Message 6 of 18
(4,667 Views)
Wacek, did you ever get this to work?  I'm curious as I would like to do something similar and am concerned with the time it will take.

Thanks, -Rob
0 Kudos
Message 7 of 18
(4,573 Views)
I'm also curious as to what's going on. The recommendations that Darren made should have drastically improved performance for you, so it's more likely that the method you are using to acquire the data that you insert into the tree control is taking you so long. I wrote a simple VI that demonstrates creating the same tree control a number of ways:

1. Creating each child item individually.
2. Adding multiple items at a time.
3. With or without front panel updates.

All of these are timed, and indeed creating items individually without deferring front panel updates is orders of magnitude slower. Check it out. It had to be for LV 8, since option 2 doesn't exist in previous versions.


Jarrod S.
National Instruments
0 Kudos
Message 8 of 18
(4,558 Views)

Dear Jarrod and the others,

I took your VI and I tried to modify it a little bit for one of a customers. He noticed the problem discussed in this post. He is working with LV 7.1 and thus, he knows he can't employ the properties 'Add multiple items at a time'. I rewrote the VI for him and tried to do the little modifications he want... But I can't do that and I'm afraid....  Smiley Sad 

He want to do that : The tree is created without front panel update. The user checks the correct parent and select it by a double-click (who is linked to an event structure). Then the program rewrites the tree with only the selected parent and his children. I do that but it's not completed because I can't find the position of the selected item !

Anyone of you can help me???

Thanks a lot,

 

Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
0 Kudos
Message 9 of 18
(4,495 Views)
Hi Julien,

There's an invoke node for Tree Controls in LabVIEW 7.1 called Double Click. It registers the last element in the tree structure to get double clicked. Place that invoke node inside the Double Click event case for the tree and you'll find out what element was selected. Hope this helps!
Jarrod S.
National Instruments
0 Kudos
Message 10 of 18
(4,423 Views)