Why does my code generation/publish process take so long?

The entire process of generating instantiable TcCOM modules runs through two phases. code generation and the publish process. The diagnostic viewer of Simulink® shows:

################################################################################

### You can use the C++ project TctSmplTempCtrl.vcxproj to build the TcCOM module manually with Microsoft VisualStudio.
### Necessary source and project files have been generated successfully.
### Duration of the code generation (HH:MM:SS): 00:00:15
### Publishing TcCOM module ####################################################
### Configuration: "Debug" ### Platform(s): "TwinCAT RT (x86); TwinCAT RT (x64)"
### TwinCAT SDK: "C:\TwinCAT\3.1\SDK\"
### Platform Toolset: "Microsoft Visual C++ 2015 (V14.0)" (Automatically selected)
### Now you can instantiate the generated module in TwinCAT3 on the target platform(s) "TwinCAT RT (x86);TwinCAT RT (x64)".
### Publish procedure completed successfully for TwinCAT RT (x86);TwinCAT RT (x64)
### Duration of code generation and build (HH:MM:SS): 00:00:24
### Generating code generation report ###############################

Notes on the duration of the code generation

The duration of the code generation depends to a large extent on the individual model and is made up of the code generation of the Simulink Coder and the code generation for the TcCOM framework. Accordingly, the TE1400 only has influence on the TcCOM framework.

If large parameter lists, e.g. look-up tables, are marked as tunable, the look-up table is entered in the tmc file to be generated, which may result in extended code generation duration.

Notes on the duration of the publish process

The Publish process consists of compiling the C/C++ code with the MS Visual C++ compiler, linking, and copying the module files to the Publish directory (<TwinCAT folder>\3.1\CustomConfig\Modules). Accordingly, the compiler performance is crucial for this step. It depends on the compiler version and the settings (e.g. debug or release).

In Simulink® under Tc Build it is possible to compile binaries for different target systems. These are created in a successive process. If you want to build a large model, it is advisable to focus on the platform(s) that you will actually use later.