title: Super slow ts-loader times when transpileOnly: false?
body: <p>I'm trying to diagnose some slow build speeds.  Here are some quantities that I think are relevant.  I'd like to know if there's a likely explanation and optimization for speeding these up without too much compromise on developers. It's a pnpm <code>hoist=false</code> monorepo with multiple typescript v4 projects in dependency relationships.  A tip-most project is webpacked, because of the font, image and style assets that I want to process and bundle as a library.</p>
  <h2>tsc --build</h2>
  <pre><code>Types:                80
  Instantiations:        0
  Memory used:    1324253K
  I/O read:          1.71s
  I/O write:         0.00s
  Parse time:       17.67s
  Bind time:         2.93s
  Check time:        0.00s
  Emit time:         0.00s
  Total time:       20.60s
  
  Found 428 errors.
  </code></pre>
  <h2>webpack 4 &amp; ts-loader v8.0.14 with <code>projectReferences: true, onlyCompileBundledFiles: true, declarations: false, transpileOnly: true</code></h2>
  <blockquote>
  <p>~142 seconds, 22MB memory ceiling (according to Windows Task Manager)but, of course, no errors found.</p>
  </blockquote>
  <h2>webpack &amp; ts-loader with <code>transpileOnly: true</code>, <code>sourceMap: false</code> and no <code>devtool</code>.</h2>
  <blockquote>
  <p>Completes in 3.67 hours!  high memory usage</p>
  </blockquote>
  <h2>webpack &amp; ts-loader with <code>transpileOnly: false</code></h2>
  <blockquote>
  <p>~2 <em>hours</em>, 26 <em>GIGS</em> memory ceiling (using <code>NODE_OPTIONS=--max_old_space_size=32768</code>), finds 428 errors.</p>
  </blockquote>
  <p>There are fewer than 3000 source .tsx? files, but there seem to be over 5000 more .d.ts files processed from node_modules (even though <code>skipLibCheck: true</code>). Since it does ultimately finish accurately, it's doing SOMETHING and making progress. I think it's known that webpack sourcemaps can fine you 60%, but I don't think that's all that's happening here.</p>
  <p>Obviously there are tons of details and settings that I'm not mentioning, but perhaps you've found a secret that I should be checking out?  Have you found ts-loader have a huge penalty when type-checking compared to a regular tsc build or a ts-loader transpileOnly build?  Any advanced diagnostic techniques I might use to crack this?</p>