You copied the Doc URL to your clipboard.

How to minimize compilation build time

To minimize how long the compiler takes to compile your source code, you can:

  • Avoid compiling at -O3 level. -O3 gives maximum optimization in the code that is generated, but can result in longer build times to achieve such results.

  • Precompile header files to avoid repeated compilation.

  • Minimize the amount of debug information the compiler generates.

  • Guard against multiple inclusion of header files.

  • Use the restrict keyword if you can safely do so, to avoid the compiler having to do compile-time checks for pointer aliasing.

  • Try to keep the number of include paths to a minimum. If you have many include paths, ensure that the files you need to include most often exist in directories near the start of the include search path.

  • Try compiling a small number of large files instead of a large number of small files. The longer compilation time per file might be offset by less time spent unloading and unloading the compiler and obtaining licenses, particularly if using floating licenses.

  • Try compiling multiple files within a single invocation of armcc (and single license checkout), instead of multiple armcc invocations.

  • Floating licenses provide flexibility, but at the cost of speed. Consider obtaining node-locked licenses for your build machines, or some node-locked licenses locked to USB network cards that can be moved between machines as required.

  • Consider using or avoiding --multifile compilation, depending on the resulting build time.


    • In RVCT 4.0, if you compile with -O3, --multifile is enabled by default.

    • In ARM Compiler 4.1 and later, the default is --multifile regardless of the optimization level.

  • If you are using a makefile-based build environment, consider using a make tool that can apply some form of parallelism.

  • Consider your choice of operating system for cross-compilation. Linux generally gives better build speed than Windows, but there are general performance-tuning techniques you can apply on Windows that might help improve build times.