LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TreeControl: Is there any fast population and update methods?

Solved!
Go to solution

"Hi there,

 

As many of you already know, the TreeControl in LabVIEW performs pretty badly when it comes about dealing with thousands of items.

 

For those who are a bit used to software in the some corners of the Automotive Industry, I would like to create an application that mimics Vehicle Spy Monitoring Window and therefore I need to have a Tree that is pretty responsive.

 

Basically I have a CAN Analyzer receiving RX CAN Frames, those frames are divided into signals

 

Format

- DateTime  ; Frame Name ; Frame Content (HEX); Empty  (Node: Hierarchy Level 1)

-- Empty   ; Signal Name; Signal Value    ; Unit  (Node: Hierarchy Level 2)

-- ...

 

- Frame 001; 0X12345678;

-- Signal 11;  ...

-- Signal 12;  ...

-- Signal 13;  ...

...

-- Signal 2F;

..

- Frame FFF; 0X12345678;

-- ...

 

 

I know a lot of people who tried hard to address this problem, but seems it's pretty a pain to get decent performances when dealing with thousands of items.

 

The simply by deferring the updates on the Front Panel while appending the nodes, another one to use the method for adding multiple items at the end (by the way, I strongly suspect that it just does a deferring on the TreeControl, cause the performances with both ways seem pretty similar).

 

Anyway, both of those solutions are not that CPU efficient... Additionally, I also tried to play with asynchronous display, but all in all, nothing really helps.

 

Any idea to add items and update values (around every 10 ms) over a such a large set of data (thousands of items)?

 

Please find attached a sample dealing with only level 1 nodes.

 

References:

- https://decibel.ni.com/content/docs/DOC-4519

- http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Improve-Tree-Control-Performance/idi-p/1067286

- http://forums.ni.com/t5/LabVIEW/Tree-control-best-fast-way-to-initialize/td-p/2571327

"

0 Kudos
Message 1 of 9
(3,843 Views)

Try to sort your data first, then construct your tree using binary

tree traversal to keep the immediate parent reference available

while adding child leafs.

 

At least that made tree construction faster in WxWidgets.

 

Even with the additional prior sorting.

 

But I bet it depend on the tree implementation if it features

integrated binary tree traversal to add children.

0 Kudos
Message 2 of 9
(3,803 Views)
Solution
Accepted by topic author Ehouarn

There is the Defer Update property of the Panel that you can set to true before doing many control updates and then set it back after. But that is not going to give you sub 10ms speed. You will have to do some smart updating only updating the part that is currently visible to the user and adding elements as the user expands tree leaves or scrolls around. Updating thousends of elements every 10 ms is NOT going to work in any UI widget library I know of.

Rolf Kalbermatter
My Blog
Message 3 of 9
(3,797 Views)
Solution
Accepted by topic author Ehouarn

Updating the tree control every 10ms seems excessive to me - typically I update user interfaces at anything from 100ms -> 500ms intervals. Faster than that and it becomes very difficult to see whats going on or the numbers are changing so rapidly that you can't read them properly.

 

As soon as you separate your data from your user interface then you'll find that updating the tree control (with deferred panel updates) isn't a bottleneck anymore. One thing I have also done before is assign an 'ID' to an item so I can search for and update it individually rather than having to redraw the entire tree (or at least, I am colouring the background of the item).

 

How are you storing your data by the way? I'm curious as I am working on a CAN application (two CAN networks with fairly high bus loading) and my current data table (using DVRs and variant attribute lookups) isn't performing as well as it needs to. Storing data as variant attributes is supposed to be very efficient for a lookup table and it also allows you to retrieve all of the items in name order (get variant attribute with the name terminal unwired) which would sort the frames/signals automatically.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 4 of 9
(3,768 Views)

Regarding 10ms.... what is the refresh rate of your monitor?

0 Kudos
Message 5 of 9
(3,739 Views)

Well now that 120/144Hz is becoming a more common refresh rate on monitors Smiley Wink


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 9
(3,722 Views)

On the other hand, I think a tree control updating at that frequency loses any semblance of readability.  If the data behind the tree is required at such speeds, then handle the data in the background at that speed but update the tree in a parallel loop at a lower frequency.

 

I can't imagine updating a tree at 144Hz or 120 Hz is going to bring any real usability advantage.

0 Kudos
Message 7 of 9
(3,714 Views)

Hi chaps,

 

Well I managed to make it faster, about the 10ms refresh rate requirement, I know it's a complete no sense, but you know some customers here in China, no matter how much you are explaining them that their eyes won't be able to catch a 10ms change they just do not give a damn about the reality, the facts but just about what they did understand in the specs (that does not mean they understand them), sometimes they just copy and paste things from Germany and they have their own very personal understanding... that lead to this sort of cr***y situation.

 

It's just so crazy, I don't even see how they are going to manage to check that part of the specs... maybe recording the screen at 120Hz (with a damn pricey camera) and then making some stupid assumptions, who knows, cause they are not even capable to reply about this verification either.

 

Anyway, let's put my rant pissing aside, and focus on the LabVIEW thing, I managed to make the updates much faster (about 5ms) by changing the Defer Update property in the right places in my block diagram.

 

Although I'm no more dealing with thousands of items anymore (guess it helps too).

 

But anyway, my underlying problem was mosty due the process for updating the values a lot of boiling code reuse that actually made the processes pretty slow.

 

 

Thanks again for your help.

Message 8 of 9
(3,580 Views)

Hello Ehouarn

 

Can you please tell me, how you achiever the 5 ms? I update my tree control using defer panel updates, but it takes (only updating the tree) around 30-40 ms, and I have currently only 4 CAN frames with their payloads. 

 

I have an array of frames in the memory, as shift register, the 4 CAN IDs, after each read the last payloads and timestamps. I tried to update only the changed data in the tree, also empty the tree and populate it again using the frames in the memory, but I just can't do it faster than 30 ms. 

 

Could you attach an example, or snippet?

0 Kudos
Message 9 of 9
(1,532 Views)