Currently, I'm facing the problem of LabVIEW execution efficient. Thus, I found a book which simply can help my programming skills in LabVIEW and eventually can solve my problems. ^^
The following notes are written by P. A. Blume, The LabVIEW Style Book
- An efficient LabVIEW application executes quickly, without performing unnecessary operations, particularly ones that are performed repeatedly within looping structures.
- An efficient application also conserves memory by limiting the size of the four LabVIEW memory components: the front panel, block diagram, data space, and code.
- Front panel and block diagram memory store the graphical objects and images that comprise the front panel and block diagram, respectively.
- Data space memory contains all the data that flows through the diagram, as well as the diagram constants, default values for front panel controls, and the data that is copied when written to variables and front panel indicators.
- Code is the portion of memory that contains the compiled source code.
- Efficient applications minimize I/O operations, such as GUI updates, instrument and network communications, and data acquisition (DAQ) calls.
- Execution speed and memory use are related.
- Memory and disk operations are a principal source of latencies in all modern computing devices. As memory consumption grows during the execution of an application, LabVIEW's memory manager is called upon to allocate new and larger memory blocks. This causes a delay while the memory manager runs and results in fragmented memory, for which some of the previous blocks are not efficiently used. The memory manager is a wonderful aspect of LabVIEW that handles memory allocation automatically. However, developers should be aware of the types of operations that might cause it to run and avoid these situations from occurring unnecessarily.
- Tools>>Profile>>Performance and Memory is directly measures the execution speed and data memory of all VIs loaded in memory. This tool helps to improve the efficiency of an application.
- Use the Profile Performance and Memory window to determine which VIs consume the most time and memory, and examine those more closely. We can optimize our VI's efficiency by iteratively making improvements and checking the profile metrics.
- The Profile Performance and Memory window is best used for measuring the change in efficiency of a single application when incremental modifications have been made.
- An alternate method of evaluating efficiency is simply to inspect the application for sources of inefficiency.
- Look for unnecessary operations within loops and for operations that create new data buffers. For example, contains many nodes within the main While Loop (includes read local variables, which make copies of their data when read from, and Property Nodes that are written within every iteration, regardless of whether their value has changed).
- Tight loop is several control terminals are polled within the innermost While Loop as fast as the loop can run.
- High-speed GUI polling is not an efficient use of the processor (most humans cannot distinguish between a 1 ms and a 100 ms GUI response).
- More efficient alternatives include adding a delay using the Wait (ms) function or using an Event structure to service all user interface activity, and these alternatives free the processor to work on parallel tasks and applications.
- Event structures are the most efficient method of capturing user interface activity.
- Shift registers are much more efficient alternatives to variables, and queues are more much more functional.
- Makes good used of sub VIs can increase memory efficiency, but uses sequence structures can decrease processing efficiency.
- SubVis reduce the quantity of nodes on the diagram and reduces block diagram memory.
- LabVIEW can reclaim memory buffers used by subVIs when the subVIs are not executing, thereby reducing data memory use.
- Sequence structure is called, all frames must execute through completion, in consecutive order.
I will continue share the useful tips from this book since I'm reading it. I hope it is useful for you all too.