title: Why would using a precompiled header cause a build to be slower?
body: <p>Our solution contains over 100 projects, over 8000 cpp files and over 10'000 header files.</p>
  
  <p>I'm trying to improve our build times.</p>
  
  <p>One of the projects in the solution contains just 5 cpp files, and takes about 10 seconds to compile.  The header files were initially included in the cpp files, but in preparation for switching on precompiled headers, I moved the includes into a single pch.h file.</p>
  
  <p>Each cpp file now includes the pch.h file.</p>
  
  <p>This in itself has not made any discernible change to the compile time - it's still about 10 seconds.</p>
  
  <p>Now when I tell the project to actually use the pch file as a precompiled header, it takes 17 seconds to compile the project.</p>
  
  <p>Why would precompiling the included headers make the project take longer to build than when the file is just #included by each individual cpp file?</p>
  
  <hr>
  
  <p>More info.</p>
  
  <p>We use a technique called "lumping" - (individual cpp files are not compiled individually - they are each #included into a single project-wide cpp file, and that is the only cpp file which is compiled).</p>
  
  <p>For what it's worth, thanks to spaghetti code, according to "Show Includes" the dozen or so included files in the pch file cause around 3000(!) files to be included.  Obviously, this needs fixing!</p>
  
  <p>The precompiled header file is about 130Mb when compiled.</p>
  
  <p>If we switch off lumping, the single project build (not the whole solution) takes 45 seconds.  If we then switch on precompiled headers, the build time improves.</p>
  
  <p>I'm probably missing the obvious, but why when lumping is switched on, does switching on precompiled headers slow the build down?</p>