Use memcpy for vector assignment
Optimize code generated for vector assignments
Model Configuration Pane: Code Generation / Optimization
Description
The Use memcpy for vector assignment parameter specifies whether to optimize code generated for vector assignment by replacing for loops with memcpy.
Dependencies
When you select this parameter, the associated parameter Memcpy threshold (bytes) is enabled.
Settings
on | off- On
Enables use of
memcpyfor vector assignment based on the associated threshold parameter Memcpy threshold (bytes).memcpyis used in the generated code if the number of array elements times the number of bytes per element is greater than or equal to the specified value for Memcpy threshold (bytes). One byte equals the width of a character in this context.- Off
Disables use of
memcpyfor vector assignment.
Tips
If the destination of a
memcpyis not changed, the code generator can further optimize the code by replacing thememcpyfunction call with pointer assignments. For more information, see Convert Data Copies to Pointer Assignments (Embedded Coder).
Recommended Settings
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | On |
| Safety precaution | No impact |
Programmatic Use
Parameter: EnableMemcpy |
| Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
Version History
Introduced in R2008b