Main Content

Improving Compilation Performance

Workflows, techniques, and examples of speeding up compilation of large models

Optimization techniques for speeding up compilation of large models include scalable compilation, incremental compilation, and memory or disk caching for model compilation artifacts.

Scalable compilation helps reduce compilation time for models that consist of a pattern of repeated components, such as transmission lines or battery packs, by compiling a repeated component once and then reusing these compilation artifacts for other instances of the same component. Scalable compilation improves compilation performance, it does not reduce the simulation time of the model.

Incremental compilation reuses compilation artifacts of reusable components for subsequent compilations, unless the component has been modified between simulation runs. Incremental compilation and memory caching result in improved performance for repeated model simulations and block diagram updates within the same MATLAB® session.

To take advantage of scalable and incremental compilation, you need to designate reusable components and enable component reuse. Memory caching is performed automatically.

Instead of memory caching, you can choose to store the cached compilation artifacts on disk. Disk caching persists between MATLAB sessions and therefore improves the performance of the first compilation of a model in a given session.

Model Settings

Reuse components during compilationOption to specify whether to enable component reuse for scalable and incremental compilation (Since R2021b)
Store cached compilation artifacts on diskOption to specify whether to store cached compilation artifacts on disk or in memory (Since R2024b)
Enable multithreaded compilationOption to specify whether to use multithreaded compilation on multicore machine (Since R2023b)

Topics

Component Reuse

Scalable Compilation

Other Optimization Techniques