Search code examples
asp.net-mvc-4razorenginewebforms-view-engine

WebForms view engine is slower that Razor view engine in MVC4


I am still a beginner to MVC and I was trying to understand why developers seem to prefer Razor engine over WebForms engine in ASP.Net.

My question: Is it because Webforms engine is slower than Razor engine?

Personally, Webforms engine comes more easily to me because I have been coding in Webforms for the last 12 years.


Solution

  • Performance wise there should be no difference. The razor engine was developed to give a more concise syntax as explained in the question Does Razor syntax provide a compelling advantage in UI markup?. What will give you a performance boost is removing the unused view engines. For example if you use only razor, then in the Global.asax.cs file

    // Remove view engines except razor
    ViewEngines.Engines.Clear();
    ViewEngines.Engines.Add(new RazorViewEngine());