本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

性能

有关提高所生成代码的性能的规范

模块

MATLAB FunctionMATLAB 代码包含在生成可嵌入式 C 代码的模型中

函数

coder.inlineControl inlining in generated code
coder.unrollUnroll for-loop by making a copy of the loop body for each loop iteration
coder.constFold expressions into constants in generated code

示例和操作指南

Unroll for-Loops

Control loop unrolling.

Inline Code

Inlining eliminates the overhead of a function call by replacing the function call with the body of the function.

Avoid Data Copies of Function Inputs in Generated Code

Generate code that passes input arguments by reference.

Generate Reusable Code

To reuse functions, save them in files or integrate external functions into generated code.

Control Run-Time Checks

Improve performance by disabling run-time checks.

概念

LAPACK Calls for Linear Algebra in a MATLAB Function Block

LAPACK function calls improve the simulation speed of MATLAB Function block algorithms that call certain linear algebra functions.

BLAS Calls for Matrix Operations in a MATLAB Function Block

BLAS function calls improve the simulation speed of MATLAB Function block algorithms that call certain low-level vector and matrix functions.