Effects of Code Complexity on Compile Time

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Each time LabVIEW compiles a VI, the compiler attempts to apply certain optimizations to the block diagram in order to maximize the eventual execution speed of the VI. To perform these optimizations, the compiler must analyze the existing code to determine where optimizations are possible and helpful. This analysis requires both memory and time in proportion to the code complexity of the VI. Therefore, as the amount of code in a VI increases, the memory and time that the compiler requires to perform the optimizations also increases.

Because of the memory demands to optimize exceedingly complex VIs, the compiler can potentially run out of memory or cause significant delays when it tries to compile these VIs. To avoid this problem for the vast majority of VIs, the compiler compares the complexity of each VI to a compiler optimizations threshold that causes the compiler to limit these memory-intensive optimizations when the complexity of a VI exceeds the threshold. However, limiting optimizations inherently prevents the VI from achieving maximum execution speed. Therefore, for complex VIs, the compiler produces a tradeoff between editor responsiveness and VI execution speed.

You can avoid this tradeoff entirely by dividing your VIs into subVIs. This approach yields a responsive editor, optimized execution speed, and maintainable, readable code. However, for VIs that you cannot reasonably divide further into subVIs, LabVIEW allows you to adjust the threshold to address the following situations:

  • LabVIEW runs out of memory while compiling a VI or building an application.
  • LabVIEW exhibits significant delays while compiling a VI or building an application.
  • You want to compile the VI or built application for maximum execution speed after you finish editing it.


Not Helpful