You can optimize the code the code generator produces for a specific processor by configuring the code generator to use a code replacement library (CRL) during code generation. If you have an Embedded Coder® license, you can develop and apply custom code replacement libraries.
For more information about replacing code, using code replacement libraries that MathWorks® provides, see What Is Code Replacement? and Replace Code Generated from Simulink Models. For information about developing code replacement libraries, see What Is Code Replacement Customization? and Develop a Code Replacement Library.
You can use the real-time profiling capability to examine the results of applying the processor-specific library functions and operators to your generated code. After you select a processor-specific code replacement library, use the real-time execution profiling capability to examine the change in program execution time.
Use the following process to evaluate the effects of applying a processor-specific code replacement library when you generate code:
Enable real-time profiling in your model. Refer to Code Execution Profiling.
Generate code for your project without specifying
a code replacement library (the default Code replacement
library setting is
Profile the code, and save the report.
Rebuild your project using a processor-specific code replacement library.
Profile the code, and save the second report.
Compare the profile report from running your application with the processor-specific library selected to the profile results in the first report with no code replacement library selected.
For an example of verifying the code optimization, search help for "Optimizing Embedded Code via Code Replacement Library" and select the example that matches your IDE.