speed up c++ compilation

How c++ compilor work?

Speed up tips

  • check code
    • Don’t include not needed headers, use forward declaration for class if possible
    • Pimpl (pointer to implementation), interface and implement do their job clear
    • Reduce interdependency
    • Clean not needed headers
    • inline and template
    • Guard Conditions
  • other tips
    • PCH (Previous Compile Header)
    • Unity Build
    • ccache
  • compile resource
    • parallel compile, compile multiple modules at the same times
    • use more faster computer
    • distribute compile

Reference