To allow you to edit large VIs without significant delays, LabVIEW automatically limits compiler optimizations when the complexity of a VI exceeds a certain threshold. As a tradeoff for limiting these optimizations, these large compiled VIs may not run at maximum execution speed. To give you control over when LabVIEW prioritizes editor responsiveness over execution speed, you can adjust the complexity threshold at which LabVIEW begins limiting optimizations.
||Tip You can avoid this tradeoff completely by breaking your large VIs into subVIs. This approach reduces the complexity of the VI, thereby optimizing editor responsiveness, execution speed, and code readability.
If you cannot divide a large VI further into subVIs, consider adjusting the complexity threshold in the following situations:
- A large VI causes delays when LabVIEW compiles the VI.
- LabVIEW runs out of memory when compiling a VI.
- You finish developing a large or complex VI and want to optimize it for execution speed.
What to Do
Complete the following steps to choose between editor responsiveness and VI execution speed:
- Identify a VI for which you want to change either the editor responsiveness or execution speed.
Although the complexity threshold is an environmental setting that applies to all VIs, you can use the complexity of an individual VI to decide whether the current threshold accomplishes your goals for that VI.
- Identify the complexity of the VI.
Refer to the Compiled Code Complexity value on the Memory Usage page of the VI Properties dialog box.
- Compare the complexity of the VI to the threshold for compiler optimizations.
Refer to the Compiler optimizations slider on the Environment page of the Options dialog box. The value of the slider indicates the VI complexity above which the compiler limits optimizations to improve editor responsiveness. If the complexity of a VI is lower than the value of the slider, the compiler applies optimizations to the VI.
- Adjust the complexity threshold if doing so accomplishes your goals.
- To prioritize editor responsiveness or prevent out of memory errors, lower the slider below your VI complexity.
- To prioritize execution speed, raise the slider above your VI complexity.
- Recompile the VI to apply changes.
(Windows) Press <Ctrl> while you click the Run button.
(Mac OS X) Press <Command> while you click the Run button.
(Linux) Press <Alt> while you click the Run button.
- Change the complexity threshold to 5 after you finish developing or deploying the VI.
Because the complexity threshold applies to all VIs, National Instruments recommends that you generally use the default value of 5 for the threshold. This value ensures that LabVIEW correctly prioritizes editor responsiveness and execution speed for the vast majority of VIs.
Tips and Troubleshooting Information
- To avoid the tradeoff between editor responsiveness and execution speed, reduce the complexity of large VIs by moving sections of code into subVIs. This approach simultaneously optimizes editor responsiveness, execution speed, and code readability.
- If you cannot identify which VI in a project is causing a long build time or an out of memory error, decrease the Compiler optimizations slider by one increment at a time until the problem improves.
- The complexity threshold applies to all VIs. Therefore, if you leave the threshold set at a non-default value, other VIs might exhibit unexpected changes in editor responsiveness or execution speed.
- The compiler ignores the complexity threshold when building an application for targets running on PowerPC or ARM architecture (VxWorks and NI Linux Real-Time targets, respectively). These targets require VIs to use certain compiler optimizations. Therefore, lowering the complexity threshold below the VI complexity might not allow LabVIEW to build the application much faster, and raising the threshold above the VI complexity might not improve execution speed.
- You can programmatically interact with VI complexity and the complexity threshold by using the Compiled:Code Complexity property, the Compiled:Last Compiled With property, and the Application:Compiler Threshold property.