title: Razor Generator: Is this accurate?
body: <p>I recently queried the former Lead Developer at my current place of employment as to why he chose to use the <strong><em>Razor Generator</em></strong> to pre-compile our views in to a separate assembly.</p>
  
  <p>He made some claims below, but I can't seem to find any <strong><em>Razor Generator</em></strong> profiles and/or metrics on the web to back up the claim (10-100 times faster), and/or, if what <strong><em>IIS7/ASP.NET</em></strong> does behind the scenes regarding pre-compiled vs. runtime-compiled views and their benefit or the lack-there-of.  </p>
  
  <p>Can anyone point me in the right direction?  Or comment?  </p>
  
  <p>It seems to me (as far as startup time is concerned) simply setting IIS <code>autostart = true</code> for the site would balance out any benefit of pre-compiling using the <strong><em>Razor Generator</em></strong>.  Here is his statement:</p>
  
  <p>Why are we using the Razor Generator to pre-compile our views and why put them in a separate assembly?</p>
  
  <blockquote>
    <p>The first is simple, compile-time error checking. With this many views
    it seemed like a great way to avoid errors on production. It's a bit
    frustrating having to recompile to see the changes to the views I
    admit, but it is (in my opinion) totally worth it to know that you
    have that much more error checking upfront.</p>
    
    <p>The second is that when the views aren't compiled in a project they
    get compiled at runtime and then those compiled representations have
    to be stored in ram. Sometimes, if they're not accessed regularly
    (which is the case with most of those views since there are so many)
    those stored compiled versions get abandoned and garbage collected to
    save ram. So all but the most frequently accessed views in a site like
    gaf.com end up being recompiled every time they are accessed. But if
    you put them in a project the compiled versions just need to be loaded
    from the dll if it's not already in memory (yes code can be garbage
    collected too, but less often). Loading that from the dll is 10 - 100
    times faster (that's from the Razor Generator project's site - I
    didn't verify it myself, but it sounds reasonable).</p>
  </blockquote>