Code Efficiency Tradeoffs
Improve the efficiency of the generated code by removing code that performs subnormal number calculations or guards against a possible mismatch between simulation and code generation results.
Model Settings
Topics
- Design Techniques to Optimize Models for Efficient Code Generation
Apply design tools and techniques to optimize a model for code generation.
- Optimize Generated Code Using Code Efficiency Tools and Techniques
When generating production code from your model to deploy into a real-time embedded system, code efficiency is an important consideration.
- Configure Model for Code Generation Objectives by Using Code Generation Advisor
Use the Code Generation Advisor to check your model against code generation objectives.
- Generate Efficient Code by Setting Model Configuration Parameters
Choose the efficiency level and priorities for your generated code.
- Remove Code for Out-of-Range Floating Point to Integer Conversions
If the input values in your application are in the range of the output type, remove code for out-of-range floating-point to integer conversions.
- Remove Code That Maps NaN to Integer Zero
If input values of
NaNdo not exist in your application, specify that the code generator remove code that mapsNaNto integer zero. - Disable Nonfinite Checks or Inlining for Math Functions
Use code replacement library (CRL) customization entries to selectively disable nonfinite checks for math functions and inlining of math functions.
- Subnormal Number Execution Speed
Minimize the possibility of execution slowdowns or overruns due to subnormal number calculation latency.
- Remove Code That Guards Against Division Exceptions for Integers and Fixed-Point Data
Optimize the generated code by removing code that protects against division by zero and overflows in division
INT_MIN/-1operations for integers and fixed-point data. - Remove Code from Tunable Parameter Expressions That Saturate Against Integer Overflow
Remove code that prevents integer overflow of tunable expression parameters for efficiency benefits.