11-16-2013 03:22 AM
Hi,
I have read some materials about LV programming and good programming style, but I have one question. Which code on the picture is more correct in respect to dataflow performance etc.
I am always new in LV
11-16-2013 03:40 AM
You only have one part circled. What should we compare it to?
11-16-2013 03:47 AM
I would like to know, whether the bundling (or missing bundling) at the end (circled) of the diagram has some influence on the dataflow.
11-16-2013 10:11 AM
Well, if any of the cluster elements change, you need to re-bundle if you want to continue with the changed values. If they don't, you don't.
The important question is if any of the subVIs change the values of any of the cluster elements? We cannot tell from a picture!
The requirements are given by the functionality you need. I don't see what your concern is with dataflow. The case cannot finish until everything in it has completed.
Of course you only need to unbundle what is used in the case, and re-bundle what actually changed. For example the "outputs" elements does not need to be unbundled..bundled at all. For the rest we don't have sufficient information to decide.
11-18-2013 03:19 AM
I see I was confused by the amount of information I read. Now it is clear and it would be nice if the moderator could delete this stupid question.
11-18-2013
03:29 AM
- last edited on
12-16-2024
10:03 AM
by
Content Cleaner
Dear Charlie,
As it has been posted before, you only need to Bundle the data that has been changed inside your case structure. The only additional consideration for performance is that if you have any arays inside the data cluster, make sure you do not increase the array size (add new elements) in every iteration. This will cause the code to allocate a larger chunk of memory every iteration, and as you can imagine, this is quite a performance drain, especially when the array gets bigger in time.
Kind regards:
Andrew Valko
NI Hungary
11-18-2013 02:03 PM
Thank you for answer. Maybe, I can use this thread to help me with another question which I am not sure about.
Imagine, I have an object e.g. Tree and this object has an atribute the real reference to the tree control on top VI FP. Many functions (VIs) working with this object (the reference) exist. E.g. clear tree, add new items, etc. All these functions using the reference via Property Node. Where should the reference be closed ? In every function (VI) after it performs its task or in the end of whole app in topVI ?
11-18-2013
05:41 PM
- last edited on
12-16-2024
10:03 AM
by
Content Cleaner
@charlie87 wrote:
Imagine, I have an object e.g. Tree and this object has an atribute the real reference to the tree control on top VI FP. Many functions (VIs) working with this object (the reference) exist. E.g. clear tree, add new items, etc. All these functions using the reference via Property Node. Where should the reference be closed ? In every function (VI) after it performs its task or in the end of whole app in topVI ?
If you make a explicit reference (right-click on the tree, create->reference), you don't need to close the reference at all. It is bounded to the VI. If you dynamically find that reference, then you need to close it when you are done manipulating it. In general, VIs that have references passed in should have the same reference being passed out. This helps a lot with trying to keep you wiring clean.
And just for additional reading:Closing References in LabVIEW
11-18-2013 11:06 PM
Hi,
I can see there are 3 aspects of my opinion.
1. If you see a reference or the output change while coming out of a subVI, then bundling it again is must (If you dont bundle, then it is a bug).
2. If the reference or the output never changes while coming out of a subVI, bundling is not needed (In case if you bundle, that doesnt hurt with respect to functionality).
3. Having said the point 2, in case you see this unnecessary bundling happening in a loop several times, it affects the memory (buffer allocation) for sure. Anything that is a hurdle can always be avoided.
Regards,
Muthuraman S