Increasing build time of my project when converting configurable to variant subsystem
3 views (last 30 days)
Show older comments
I tried converting configurable subsystem to variant subsystem through code. The code is increasing my project build time. Is there anything which we can do for optomisation?
0 Comments
Accepted Answer
Anushka
on 5 May 2025
As you have correctly mentioned that converting a Configurable Subsystem can lead to increased build times, especially if not configured optimally. There are several ways to improve performance and reduce build time:
1. Efficient Variant Activation Times can be used; you can set the 'Variant Activation Time' to 'code compile' or 'startup' rather than 'update diagram' or 'init' to minimize simulation overhead.
You can refer to the following documentation: https://www.mathworks.com/help/simulink/var/simulate-variant-blocks-in-accelerator-rapid-accelerator-modes-with-startup-activation-time.html
2. Enabling Conditional Compilation can be helpful here, this ensures that only the active variant’s code is generated, reducing code generation and compilation effort. It can be enabled via parameter: 'GeneratePreprocessorConditionals' = 'on'
You can refer to the following documentation: https://www.mathworks.com/help/releases/R2021a/ecoder/ug/generate-preprocessor-conditionals-for-variant-systems.html
3. You can use Simulink.Parameter objects instead of hard-coded or global variables to improve code clarity and tuning options. Avoid setting unnecessary parameters as tunable.
You can refer to the following documentation: https://www.mathworks.com/help/simulink/var/use-variant-control-variables-in-variant-blocks.html
4. Model References can be used for each variant branch if possible. This allows reuse of compiled models and faster incremental builds.
You can refer to the following documentation: https://www.mathworks.com/help/simulink/ug/overview-of-model-referencing-1.html
5. Unused Variant Choices can be removed. Redundant branches increase parsing and compilation times.
Hope this helps!
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!