Solution
There are several performance trade-offs to consider when selecting which method to use for updating your front panel controls. The available update methods are Controls/Indicators, Local Variables, or Value Property Nodes. Here are the benefits and negatives of each method:
Controls/IndicatorsBenefits
- Built in logic to prevent front panel updates when continuously updating the same value. This prevents front panel re-draws.
- Do not need to de-reference pointers, nor make copies of the data in memory. As such this is the fastest, and least memory intensive option.
Negatives
- You cannot write to a single item in a cluster/array, but must update the entire variable
C analogy (this is not a C equivalent, but helps to show the steps that must be taken to update a corresponding front panel control/indicator).
int x; // Front Panel Indicators
x = 10; // Write directly to the Front Panel Indicator.
Local VariablesBenefits
- Have built in logic to prevent front panel updates when continuously updating the same value. This prevents front panel re-draws.
- Do not need to de-reference pointers, unlike property nodes. As such they are faster than property nodes.
Negatives
- Memory intensive process. These have the same front panel update logic as controls/indicators, however they must make a full copy of the data in memory for each local variable you create.
- You cannot write to a single item in a cluster/array, but must update the entire variable.
- Race conditions may occur if you are writing to and reading from the same local variable at different rates.
C analogy (this is not a C equivalent, but helps to show the steps that must be taken to update a corresponding front panel control/indicator).
int x; // Front Panel Indicator
int y; // Local variable
y=10; // Write to local variable
x=y; // LabVIEW does this for you to update the front panel.
Property NodesBenefits
- Do not create copies of data in memory unlike Local Variables.
- If you are using a non-strict control reference, then the data type of the value may be a variant rather than the actual data type of the control.
- Capable of reading and writing of a single control within a cluster
- Can be used to update front panel controls from within a SubVI
Negatives
- Required to update the front panel item every single time they are called.
- They are a pass by reference function as opposed to a pass by value function. This means they are essentially pointers to specific memory locations. The pointers must be de-referenced, and then the value in memory updated. The process of de-referencing the variables causes them to be slower than Controls/Indicators, or Local Variables.
- Property Nodes cause the front panel of a SubVI to remain in memory, which increases memory use. If the front panel of a SubVI is not displayed, remove property nodes to decrease memory use.
C analogy (this is not a C equivalent, but helps to show the steps that must be taken to update a corresponding front panel control/indicator).
int x; // Front Panel Indicator
int *x_pointer = &x; // Create pointer to Front Panel Indicator
// (Property Node)
*x_pointer = 1; // * is used to dereference the pointer and update
// variable X. This is the operation that happens
// every time a property node executes.