LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Many tunnels or many unbundles?

I have often setup VI's where the user's settings get populated into a cluster on startup. I have always just unbundled what I needed when I needed it, as shown in the Top part of the JPG. The amount of Unbundles is usually equal to the number of states in the state machine.

 

On a recent project, just because I didn't currently know which states of the state machine would need what data from the cluster, I just unbundled everything and sent tunnels to the state machine, and wired up what I needed, when I needed it, like the bottom part of the JPG. This has made for a cleaner diagram (inside the state machine).

 

Which of these two methods has the least impact on memory and performance? I guess it boils down to many tunnels and one unbundle, or vice-versa.

 

thanks

 

 

 

 

 

Message Edited by Broken Arrow on 03-11-2009 11:12 AM
Richard






0 Kudos
Message 1 of 7
(3,578 Views)
If your main concern is memory efficiency I would probably stick with the second (tunnels) version. But the first approach makes the application more readable and the code cleaner - you just bundle/unbundle what you need in each case.

There is one important thing to mention. The first version (bundle/unbundle) should not contain big arrays of data since it may lead to significant performance hit. There was a big thread about it some time ago. 

I personally combine both approaches. The single values are bundled into cluster and unbundled/bundled when needed. The data array shift registers are kept separately.
Message Edited by ceties on 03-11-2009 11:25 AM
LV 2011, Win7
Message 2 of 7
(3,560 Views)

I agree with ceties' approach.

 

If you ever need to change a value in the cluster in one or more cases, you should pass the cluster wire into the case.  In the tunnel version you would need to bundle and rewrite everything on every iteration - not efficient at all!

 

Lynn 

0 Kudos
Message 3 of 7
(3,546 Views)

thanks ceties, excellent points.

 

Johnsold, the data never changes - it is "setup" data - thus never a Bundle, just Un'.

 

Richard






0 Kudos
Message 4 of 7
(3,510 Views)
An additional advantage the top method has is that you can search for all the places where you use a specific element. In the bottom method, you would have to cycle through all the cases (which isn't that bad if the wires are straight, but the wires can get screwed up sometimes if things are moved). Another thing is that if you want to add an element in the middle (e.g. to keep clean wiring) it's easier to do if you have the unbundles inside the cases.

___________________
Try to take over the world!
0 Kudos
Message 5 of 7
(3,501 Views)

ceties wrote:
If your main concern is memory efficiency I would probably stick with the second (tunnels) version. But the first approach makes the application more readable and the code cleaner - you just bundle/unbundle what you need in each case.

There is one important thing to mention. The first version (bundle/unbundle) should not contain big arrays of data since it may lead to significant performance hit. There was a big thread about it some time ago. 

I disagree. The two methods are just the same, according to speed and memory efficient.

Personally i was ecpecting the first method to be faster, but it is not.

It is the same. I guess Labview is quite smart and optimizes the code.

I did only one, small test , so i may be wrong. Maybe someone could confirm.

 

About the thread you mentioned, i think i remember it, but it was not the same case. Similar, but not the same.

0 Kudos
Message 6 of 7
(3,473 Views)
This is the thread I was refering to.
LV 2011, Win7
0 Kudos
Message 7 of 7
(3,447 Views)