Contenuto principale

Optimize and Deploy Generated Code

In this step, you learn about how to optimize and deploy the generated code.

Optimization

When you generate standalone code or an accelerated MEX function from your MATLAB® code, the code generator uses a variety of techniques to produce optimized code, including:

  • Constant folding

  • Fusion of successive loops

  • Fusion of successive matrix operations

  • Elimination of unreachable code.

See MATLAB Coder Optimizations in Generated Code.

Depending on your MATLAB code and your application goals, you can employ various strategies to further improve the speed or memory usage of the generated code, such as:

  • Using parallel for-loops (parfor)

  • Unrolling for-loops and parfor-loops

  • Minimizing dynamic memory allocation

  • Forcing function inlining

  • Using BLAS, LAPACK, and FFTW libraries

  • Disabling support for nonfinite numbers and integer overflow

  • Maximizing stack usage

  • Reusing large arrays and structures

For details of these and other strategies, see Optimize Generated C/C++ and MEX Code.

Deployment

After you verify that the generated code behaves according to your requirements, you can deploy it. After you generate standalone code, you can:

See Also

Apps

Functions

Topics