Effects of Code Complexity on Compile Time

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: