Instruction Set Extensions
Instruction set extensions can be used to achieve better runtime performance. While the auto-vectorizer of the Microsoft C++ compiler already optimizes the code and automatically generates SSE2 code by default, the explicit use of instruction set extensions by Intrinsics can lead to better code performance.
When using the TE1400 TwinCAT Target for Simulink®, you can explicitly request the use of SSE2 code. To do this, use the following properties of Simulink Coder™ under Code Generation > Optimization.

![]() | Sample available in MATLAB®
|
Further information on code performance
You can make further optimizations using the Embedded Coder® from MathWorks®. To use Embedded CoderTM with TwinCAT, use the TwinCAT Target for Embedded Coder®. You can also use AVX commands with this, for example.
Also make full use of the Solver settings. In general, a “discrete” solver will perform significantly better than a higher-order solver.