.net, C# tip, MVC, Non-functional Requirements, Performance

Performance and MVC tip – Optimize your View Engines

A very quick tip to improve your MVC site’s performance…

If your application only uses one ViewEngine (e.g. Razor), then there’s no point in making MVC iterate through all its registered view engines every time to find a match, when you already know it only needs one.

So make sure you’re only using the Razor view engine by adding the code below to the Application_Start method in your Global.asax.cs file:

ViewEngines.Engines.Add(new RazorViewEngine());
This should shave a bit of time from your page loads – more in the link here.