title: How to improve Angular 2's template parsing performance?
body: <p>We're doing a rewrite of our UI using Angular 2. Since this is so new, there are very few resources available, so please excuse me, if my question seems silly and has been answered already.</p>
  
  <p>First, a little background. Our product is built out of "modules" which are widgets that can be dropped on a page. Since, not all modules are being rewritten to use Angular 2, there will be a mix of non Angular and Angular modules on one page at the same time. For this reason, we've decided to make each Angular2 module to be a stand-alone angular app.</p>
  
  <p>In the prototype phase all looked fine and dandy, however, fast forward a few months, and with just weeks before the release, someone looked at our page load times and was less than impressed. On my machine, with prodMode enabled, it takes 5 modules about 2.5 seconds to render with 2 of our most complicated modules taking a second each. The two biggest templates I've got are 32KB and 80KB in size, but since the processing time is the same, I suspect the linear length doesn't contribute as much as structural complexity, and they are pretty complex. The other 3 modules are much simpler.
  <a href="https://i.stack.imgur.com/1qsi8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1qsi8.png" alt="angular 2 modules"></a></p>
  
  <p>From this timeline it seems that a lot of time is spent in parsing the template and loading components. So I thought maybe this is because each module is an independent angular app, and they probably don't share the cached components. So I've moved the BROWSER_APP_COMPILER_PROVIDERS from the App Providers into Platform Providers list. This caused all modules to reuse a single RuntimeCompiler (I think). 
  <a href="https://i.stack.imgur.com/v48At.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v48At.png" alt="angular 2 modules shared compiler"></a>
  However in the grand scale of things, it did not improve the situation much. The total time went down to 2.3 seconds which makes it hardly worth the hassle.</p>
  
  <p>Now, the modules are mostly wizards. That is they sit and look pretty until the user taps/clicks on the them to engage. So this got me thinking, what if I could stage the template parsing? If I could tell Angular to parse wizard steps on demand I could lower load time in exchange for some lag when interacting the the module. This is what I'm researching now, but I would love to hear the community's input.</p>
  
  <p>Thank you for reading.</p>
  
  <p><strong>UPDATE</strong>: I am running RC.3.</p>