03-11-2009 11:10 AM - edited 03-11-2009 11:12 AM
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
03-11-2009 11:23 AM - edited 03-11-2009 11:25 AM
03-11-2009 11:38 AM
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
03-11-2009 01:10 PM
thanks ceties, excellent points.
Johnsold, the data never changes - it is "setup" data - thus never a Bundle, just Un'.
03-11-2009 01:35 PM
03-11-2009 02:41 PM
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.
03-11-2009 04:40 PM