1

I heard viewengines like Razor or NHaml is giving much performance than WebForm View engine. Can someone advice me if this is true and which will be the best view engine

1
  • In a recent (December) web conference, Scott Hanselman stated that Razor is faster than the WebForms view engine. Although any performance benefits are relatively minor. Commented Jan 8, 2011 at 14:05

4 Answers 4

7

If changing the view engine significantly impacts performance, there is something wrong with your design. Views are for simple display of properties in the model - nothing in there would be taking nearly as long as things like database access which happen in the controller. An order of magnitude improvement in the view rendering probably wouldn't be a noticeable difference in the time for the whole request.

MVC 3 may perform better than MVC 2, but that's just a matter of using the latest version which has improvements in all parts of the system. View engine choice is about your preferred syntax, not performance.

Sign up to request clarification or add additional context in comments.

Comments

3

MVC 3.0 still in development, so in final release performance will be even much better i guess.

Here is some Razor tests ASP.NET MVC 3 Razor performance and asp.net mvc3 razor documentation? and of cause http://haacked.com/

Comments

1

I would expect that the WebForms view engine and Razor view engine to yield similar performance as they are built on similar principles. Both work by parsing a file (ASPX vs CSHTML) to generate a codedom which itself is used to generate a compiled class. The big difference comes in the optimisations built into the parsers/code generators used by each.

Comments

0

Don't know about the exact performance between Webforms and MVC. Been working with webforms for a while and i'm currently working with MVC2 and experimenting with MVC3's Razor View Engine.

Though MVC3 is still in the RC2 state the performance is pretty good but i guess it still have to be tweaked before the final release .Rumours are that the performance should be equal to MVC2. If you ask me i think that MVC2 and the new Razor Engine aren't any slower than Webforms applications. But personally i find the code easier maintainable with MVC, that's for me the biggest reason i switched from Webforms to MVC. Don't know anything about NHaml, but would personally choose Razor, works great! It's easy to use, understandable and gives good and clean code.

EDIT:

Read Scott Guthries blogs about the MVC3 RC2 candidate. He talks about performance. See this link.

Another topic on SO already exists about performance. Read it here

It always interessting to follow the blog pages of Scott Guthrie and Phil Haacked. Both work at Microsoft and regular post about MVC3.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.