09-25-2013 05:48 AM
Hello Labviewers,
My application monitors up to 150.000 tags. I am giving the users the possibility to select a tag out of this list of 150.000 tags (in fact there are also several subgroups of tags to ease the selection process). To be as possible closest to a 'Windows-like' selection environment I have implemented a Tree Control that I feed with all my tags in an initializing stage of the application. Then the user just browse through the tree and double-click on the item he wants to select. The problem is that this init phase lasts for more than 20min (!) on a very decent and recent PC full of RAM,... The process of feeding the Tree Control itself seems very slow. I have attached the VI in this message, I have left default in the front panel (in this case less than 150.000 tags, but it is to show the structure and the selection process)
Thanks a lot for your help
Christophe
09-25-2013 06:09 AM
Christophe,
first of all, you are talking about a huge amount of memory you have to allocate for handling the items. So it will take some time to do so.
20 minutes do sound too much in the first place, so you definetly want to dig in the real source for this amount of time.
That being said, your current code cumulates THREE different tasks into a single module:
1.) Loading files. Plural, as there are obviously several files read.
2.) Parsing the strings read from each file.
3.) Populating the tree regarding of the parsing result.
Please rework your example as such that you can benchmark each individual task.
Norbert
09-25-2013 09:36 AM
Nobert,
You are right that I should have sequenced my code like you said BUT I already performed all the statistics to assess which part of the code takes time. The only part that is responsible for more than 99% of the total execution time is : Edit Tree Items.Add Multiple Items to End. I have reduced my VI focussing only on this aspect. In the Vi attached, if you change the N (number of items to add to the Tree Control) you will notice that above a certain threshold the 'time per item' starts to increase and after N>30.000 (on my PC) the PC even gets stalled and when it eventually comes to the end of the execution of the VI the 'time per item' has exploded. Best 'time per item' is 0.035ms for N=5.000.
I hope someone can help me, I think it is related to the node Edit Tree Items.Add Multiple Items to End and the way it adds, it is as if if uses a sort of build string command that worsens more and more with the size of the Tree Control.
I have also made another test: instead of trying to write say 100.000 items 'at once', I tried to split the writing into smaller bunches of 5.000 or 10.000 items but past the first iterations the Tree Control starts to fill up too much and the same problem as for the single bunch of 100.000 items occur (slow, stalled,...). Even if I defer Front Panel updates...
Thanks
Christophe
09-25-2013 09:59 AM
Although my experience with it is limited, I believe that the LV tree control is known to perform badly with a large number of elements, as you've seen. I would suggest you do a search and you can probably find some threads on the topic.
Relevant suggestions:
03-22-2017 01:54 PM
Better late than never. It's not you! I have come to the conclusion that there is no (fast!) way to generate tree content programmatically. I'm populating a tree from a DB (~178K items in tree). It takes ~1:30 to populate array (or arrays, depending on method) of clusters from the DB to be used in the Add or Add Multiple and the best I can bring it in to build the tree is about 9 minutes. This is unusable - booo.
03-22-2017 02:12 PM
@RWD wrote:
Better late than never. It's not you! I have come to the conclusion that there is no (fast!) way to generate tree content programmatically. I'm populating a tree from a DB (~178K items in tree). It takes ~1:30 to populate array (or arrays, depending on method) of clusters from the DB to be used in the Add or Add Multiple and the best I can bring it in to build the tree is about 9 minutes. This is unusable - booo.
Not sieeing your code I can only ask about the one silly trick I have used to speed up population of the GUI...
1) Defer FP.updates
2) Hide the control
3)Populate it
4) SHow the control,
5) Undefer the FP-update
Ben
03-22-2017 03:18 PM
Starting in 2013 the performance of the tree and MCLB were improved greatly. That being said those tree controls sound a bit excessive. I wonder if a better UX could be had with a combination of other control types. Like are there a few common starting point? Maybe having a drop down of the first level, then the tree populates starting with that indent would be better.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-22-2017 03:28 PM
Thanks for the thought but, I’ve been down that road and it didn’t help much. Unfortunately I can’t put the code up for a look-see but I’m pretty sure at this point that the tree usage is just slow and alternative methods (list boxes, tabs, etc.) may have to be looked at. It’s really too bad because our DB application is really nicely represented in a tree view.
The two best methods I came up with were:
One good thing is that our DB isn’t updated too often (we can check for updates) so we may just add a ‘are you really really really sure you want to regenerate the tree and if so go get coffee’ check. ;-)