Chapter 7 Code Optimization
© National Instruments Corporation 7-19 AutoCode Reference
All of the optimizations discussed so far can be used at the same time
without limitations. All of these optimizations can work together and
potentially bring about a cumulative effect in reducing the code size or
improving the execution speed of an application. In general, the restart
optimization, varblock read, and constant propagation can help reduce the
code size, while merging of INITs, constant propagation, and varblock read
optimizations improve execution speed. The reuse of temporaries helps
reduce stack size, and could prevent stack overflow problems. Prudent use
of the Constant Block can reduce code size, and its use is preferred over the
Algebraic Expression Block for defining constants. By using these
optimizations, you can generate optimal C or Ada source code. The
executable (or the object) file size depends on the compiler used for
compiling the source code. Execution speed of an application ultimately
depends on the target processor.
Table 7-1. Optimization Table for Callout Blocks
Block Output (X) Input A Input B
MatrixInverse Copy only if output is
not a single array
Mandatory copy-in Not applicable
MatrixRightDivide
or MatrixLeftDivide
(if B is z×n or n ×1)
Copy only if output is
not a single array
Mandatory copy-in Mandatory copy-in
MatrixLeftDivide
(ifB is m ×n, m > 1,
or n> 1)
Copy only if output is
not a single array
Mandatory copy-in Copy only if input
connectivity prohibits
using source array
directly