Razor generator performance

Mar 13, 2012 at 9:27 AM

We've been currently pondering about transfering our main project to MVC 3 but before that, we wanted to test MVC's overall performance.

So we generated a dummy MVC 3 project with 1000 controllers, each with 5 actions returning an instance of one of 1000 generated models (just a simple class with 20 string properties, no functionality) to a strongly generated view. 1000 controllers * 5 actions = 5000 views.

MVC did well on this test - build time just few pretty fast seconds, the project starts well, no performance issues so far.

So we went further and included Razor Generator on this test - we needed to generate the <Compile> (for *.generated.cs) and <Content> (for views themselves) tags for the csproj project file because the command "Redo-RazorGenerator" performed quite badly for 5000 views (generated approx 1.3 views per second)

Once we updated the csproj file, we opened the project.

5000 views, each with its *.generated.cs version (that's 10000 files!), causes Visual Studio 2010 to open after cca 3-4 minutes.

We don't blame Razor Generator for this though, we think it's a VS2010 issue regarding those dependency tags "<DependentUpon>" in the csproj file for the generated files ...but we're not sure, whose fault this really is and that's why I am posting this :)

Mar 13, 2012 at 4:20 PM

Hmmm, I'm not sure what would be causing that. You may be right that it's the <DependentUpon> tags. Note that after doing its initial thing, the RazorGenerator AddIn is not in the picture in this scenario.

And might be interesting to try in VS11 Beta as well. RazorGenerator itself doesn't work (yet), but you could just open the solution created from 2010.

Mar 14, 2012 at 12:04 AM

@czmotig Do you think you could throw the RazorGenerator.MsBuild route into the mix and see how well that performs?