Optimizing Execution Speed for Built Applications

After you finish developing and testing a VI or built application, you can configure settings in the LabVIEW environment and the build specification to maximize the execution speed of the application. You must wait until you finish development because these configurations can slow or prevent editing and debugging.

The following procedure improves execution speed by ensuring that LabVIEW uses full compiler optimizations to build the application.

  1. Open the build specification.
    Right-click the build specification to display the Properties dialog box.
  2. Ensure the Enable Debugging option for the build specification does not contain a checkmark.
    On the Advanced page of the dialog box, remove the checkmark from the Enable debugging checkbox. This global debugging setting allows LabVIEW to evaluate the debugging setting on individual VIs in the build specification. Therefore, in order to later disable debugging on the individual VIs in the build specification, you must not enable debugging in this global setting.
  3. Disable debugging in the build specification for each VI.
    Disabling debugging for each VI improves the execution speed of the application. Additionally, the debugging setting sometimes causes LabVIEW to recompile the VI, which is necessary to apply updated compiler settings that affect execution speed. The rest of this procedure ensures that you confirm these settings and force recompilation to occur.
    1. On the Source File Settings page of the dialog box, select each VI and click the Customize VI Properties button.
    2. Remove the checkmark from the Use VI Property checkbox next to Allow debugging.
    3. Remove the checkmark from the Allow debugging checkbox.
  4. Disable debugging in the build specification for dependencies.
    Disabling debugging for dependencies ensures that dependency VIs benefit from the same execution speed and recompilation effects as the other VIs in the build specification.
    1. On the Source File Settings page of the dialog box, select Dependencies and click the Customize VI Properties button. If the Customize VI Properties button is disabled, place a checkmark in the Set VI properties for all contained items checkbox to enable it.
    2. Remove the checkmark from the Use VI Property checkbox next to Allow debugging.
    3. Remove the checkmark from the Allow debugging checkbox.
  5. Ensure all source VIs are configured to allow debugging.
    By allowing debugging in the source VIs, you create an intentional discrepancy between the VI settings and the build specification settings from steps 3 and 4. This discrepancy ensures that LabVIEW recompiles the VIs when you build the application, thereby applying changes you make to the complexity threshold in later steps.
    Note Note  Complete the following steps only if you changed the debugging settings on any individual VIs. LabVIEW allows debugging on VIs by default.
    1. Open each VI in the build specification and dependencies list.
    2. Place a checkmark in the Allow debugging checkbox on the Execution page of the VI Properties dialog box.
  6. Configure the build specification to use all additional exclusions.
    The additional exclusions improve both the load time and execution speed of the application.
    On the Additional Exclusions page of the Properties dialog box for the build specification, place a checkmark in every checkbox.
  7. Use a pre-build VI to set the compiler optimizations threshold before building the application.
    Programmatically setting the compiler optimizations threshold in a pre-build VI ensures that the change is present when LabVIEW recompiles the VI during the build process.
    1. On the Pre/Post Build Actions page of the Properties dialog box for the build specification, click the Generate VI button to generate a new pre-build VI with the appropriate connector pane.
    2. Close the Properties dialog box for the build specification and open the pre-build VI.
    3. In the pre-build VI, programmatically set the Application:Compiler Threshold property to 10. You must enable VI Scripting to use the Application:Compiler Threshold property.
  8. Use a post-build VI to restore the compiler optimizations threshold to 5 after building the application.
    Programmatically restoring the compiler optimizations threshold in a post-build VI ensures that all other VIs that you develop correctly prioritize between editor responsiveness and VI execution speed.
    1. On the Pre/Post Build Actions page of the Properties dialog box for the build specification, click the Generate VI button to generate a new post-build VI with the appropriate connector pane.
    2. Close the Properties dialog box for the build specification and open the post-build VI.
    3. In the post-build VI, programmatically set the Application:Compiler Threshold property to 5.
  9. Build the application.
    Right-click the build specification and select Build from the shortcut menu.
    Note Note  If LabVIEW runs out of memory while building the application, configure the pre-build VI to use a compiler optimizations threshold of 9 instead of 10. Continue lowering the threshold until LabVIEW does not run out of memory.