Main Content

Use memcpy for vector assignment

Description

Optimize code generated for vector assignment by replacing for loops with memcpy.

Category: Optimization

Settings

Default: On

On

Enables use of memcpy for vector assignment based on the associated threshold parameter Memcpy threshold (bytes). memcpy is 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 memcpy for vector assignment.

Tips

  • If the destination of a memcpy is not changed, the code generator can further optimize the code by replacing the memcpy function call with pointer assignments. For more information, see Convert Data Copies to Pointer Assignments (Embedded Coder).

Dependencies

  • This parameter requires a Simulink® Coder™ license.

  • When selected, this parameter enables the associated parameter Memcpy threshold (bytes).

Command-Line Information

Parameter: EnableMemcpy
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn
Safety precautionNo impact

Related Topics