05-21-2013 07:16 AM
Please explain to me like you would explain a little child the In Place Element Structure.
I have some difficulty understanding this structure.
Optimizing speed and memory usage? Why does Labview not do this automatically in the background?
Is there a situation you do not want to optimize memory usage?
Please make me help understand and kudos will be given
Solved! Go to Solution.
05-21-2013 08:10 AM
Hi
In LabVIEW 8.5 and later, you can use the In Place Element Structure to avoid making copies of data when using an array, cluster, or waveform.
Many common LabVIEW operations, such as operating on an element of an array and placing the resulting value back into the same array index, require LabVIEW to copy data values and maintain those values in memory. This increases memory usage.
Manage Memory in LabVIEW Using a New Block Diagram Structure
05-21-2013 08:18 AM
Hello hsm78, thank you for your reply.
I understand what you are saying, what I don't understand is why does LabVIEW not automatically do this?
I see no benefit in not using the In Place Element Structure. Is the compiler not able to detect when to
use the In Place Structure?
I'm sure I need more understanding, the smart people at NI know what they are doing. It just doesn't makes sense to me yet.
05-21-2013 08:35 AM
Why does Labview not do this automatically in the background?
Usually it does. The compiler is pretty darned good about detecting when it can operate in place and will usually do so on it's own if you use the traditional cluster bundling primitives.
The in place element structure is used for more than bundling though, it must be used to operate on data value references, can help with variants, can make some array operations more efficient, and there are some fringe use cases involving object oriented programming where the structure has an explicit use that can't be produced by other means. For other situations it's just a form of explicit syntax requesting that LabVIEW do its best to operate in place if possible.
05-21-2013 08:38 AM - edited 05-21-2013 08:42 AM
Hello Heinen,
I don't have an answear to your specific questions, but I have an example:
Use the In Place Element structure when you operate on a data element within an array, cluster, variant, or waveform without requiring the LabVIEW compiler to copy data values and maintain those values in memory
http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/in_place_element/
Alex
05-21-2013 08:42 AM
Hi,
the following shows a situation in which you can use the In Place Element structure to improve the execution and memory efficiency of a VI.
05-21-2013 09:10 AM - edited 05-21-2013 09:21 AM
Alex et al,
the Inplace Element Structure was introduced in back in LV 8 (don't recall exact version). Starting with LV 8.6, following 2009 and 2010, NI made significant changes to the way how the block diagram is compiled into executable code (requiring the LV RTE).
Experience shows, that using current versions of LV (2010 and later), the Inplace Element Structure has not much benefical effect as the (pre)compiler already optimizes most of the situations where performance could be increased; honestly, in some situations the usage of this structure does DEcrease performance as the compiler must NOT optimize on his own within this structure.
There are, still, some cases where this structure can improve performance keys (like memory usage) when used prudently. And there are some cases where you have to use this structure, namely when using Data Value References.
hope this helps,
Norbert
EDIT: You can start here for further information about compiler optimization done by the LV compiler. Please note that those can depend on the "Allow Debugging" setting of the VI.