NI LabVIEW Applications
Improving Performance in
LabVIEW
Purpose of
Optimization
Profiling
Tools
Memory
Optimization
Optimization Cycle
Benchmark
Optimize
Evaluate performance
Identify problem areas
Improve efficiency
Improve speed
Improving Performance in
LabVIEW
Purpose of
Optimization
Profiling
Tools
Memory
Optimization
Perfmon
Allows you to monitor
Processors
Disk I/O
Network Tx/Rx
Memory/Paging
Access by typing
perfmon into the
Windows Run dialog
Analysis
Calibration
Benchmark Project LabVIEW Real-Time Shipping Example
VI Profiler
Timing and memory statistics for VIs
ToolsProfilePerformance and Memory
Demo VI Profiling
Detailed
execution
traces
Thread and VI
information
Measurement
of execution
time
Multiple
Sessions
Threads, CPU
and Memory
VIs
Benchmarking Summary
OS Level
Task Manager, Perfmon
LabVIEW Level
VI Profiler, Benchmark VIs
VI Level
LabVIEW Desktop Execution Trace Toolkit
Improving Performance in
LabVIEW
Purpose of
Optimization
Profiling
Tools
Memory
Optimization
VI Components
Panel
Diagram
Code
Diagram compiled into machine code
Data
Control/indicator values
Default data
Block diagram constant data
VIs in Memory
When a VI is loaded into memory
We always load the data
We load the code if it matches our platform
(x86 Windows, x86 Linux, x86 Mac, PowerPC Mac)
We load the panel and diagram only if we need to
(for instance, we need to recompile the VI)
LabVIEW Terminology
Panel data is called Operate Data
Controls and indicators have their own copy of the
data, so that front panel editing of data does not
interfere with computations in the diagram
Memory Performance
The following features affect the impact
memory allocation has on your application:
Wire Semantics and In Placeness
Type coercion
Passing values to subVIs
Shift registers
Front panel indicators
Wire Semantics
Every wire is a buffer
Branches typically create copies
Optimizations by LabVIEW
The theoretical 5 copies become 1 copy operation
Copy
Bottom Up
In-place information is propagated bottom up
Branched wire
Copy because
of increment
No copies required
Increments array in place
changes into
Changes into
Changes into
Type Coercion
Changing the data type of a wire to match
the required data type
Dots indicate automatic coercion
Requires a copy
Coercion Dot
Move
Shift Registers
Single left input always in place with right
output
Even better when the body is in place
In Place
Always In Place
Building Arrays
There are a number of ways to build arrays
and some are better than others
Bad
Reallocates array memory on
every loop iteration
No compile time optimization
Building Arrays
There are a number of ways to build arrays
and some are better than others
Better
Memory allocated
at load time
Keep graphics
below the text
Values populated
in place
and to the right.
Building Arrays
There are a number of ways to build arrays
and some are better than others
Best
Memory preallocated
Indexing tunnel eliminates
need for copies
Improving Performance in
LabVIEW
Purpose of
Optimization
Profiling Tools
Memory
Optimization
Improving Performance in
LabVIEW
Purpose of
Optimization
Profiling Tools
Memory
Optimization
Improving Performance in
LabVIEW
Purpose of
Optimization
Profiling Tools
Memory
Optimization
Next Steps
In LabVIEW
LabVIEW Help
On the Web
ni.com/multicore
ni.com/devzone
Next Steps
Visit ni.com/training
Identify your current expertise level and
desired level
Register for appropriate courses