Keil Logo

Technical Support

On-Line Manuals

Compiler User Guide

Preface Overview of the Compiler Getting Started with the Compiler Compiler command-line syntax Compiler command-line options listed by group Default compiler behavior Order of compiler command-line options Using stdin to input source code to the compiler Directing output to stdout Filename suffixes recognized by the compiler Compiler output files Factors influencing how the compiler searches for Compiler command-line options and search paths Compiler search rules and the current place The ARMCC5INC environment variable Code compatibility between separately compiled and Linker feedback during compilation Unused function code Minimizing code size by eliminating unused functio Compilation build time Compilation build time Minimizing compilation build time Minimizing compilation build time with a single ar Effect of --multifile on compilation build time Minimizing compilation build time with parallel ma Compilation build time on Windows Compiler Features Compiler Coding Practices Compiler Diagnostic Messages Using the Inline and Embedded Assemblers of the AR Compiler Command-line Options Language Extensions Compiler-specific Features C and C++ Implementation Details What is Semihosting? Via File Syntax Summary Table of GNU Language Extensions Standard C Implementation Definition Standard C++ Implementation Definition C and C++ Compiler Implementation Limits

Minimizing compilation build time

2.17.2 Minimizing compilation build time

There are a number of actions you can take to minimize how long the compiler takes to compile your source code.

These actions include:
  • 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.
  • 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 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, --multifile is disabled by default, 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.
Non-ConfidentialPDF file icon PDF versionARM DUI0375H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.