views:

59

answers:

1

How much time is spent compiling a view in ASP.NET?

Of course I don't expect anyone to give me a number, but I think it's interesting to have an idea of how much time this takes because it could influence the way we implement things.

For example, if the time is significant , then I might try to put every result that I need to display in the view in a model class instance (created just to hold the values in such a way that I don't even have to test for objects with null value) and then minimize to the maximum (uh?) the amount of C# code in the view thus decreasing the amount of time necessary to compile the view.

Question

Does this make sense? Give some thoughts on this one.

+1  A: 

To me it sounds like with this approach you are entering a world of pain. Your optimizing before knowing if there are any per issues. Better is to identify them and deal with those. Also whatever "figures" you get here are just arbitrary. Instead create some pages and trace/profile to find slow areas.

From your question it's not clear if you are using Web Forms or MVC either.

Also you might be interested in http://stackoverflow.com/questions/516160/planning-for-efficiency-early-vs-premature-optimization

Sayed Ibrahim Hashimi
It makes perfect sense and of course I will test some pages and test what time differences I will get. I did not refer to Web forms or MVC because I am not aware that view compile times were different. Are they? Using a class Model to send data to the view is already something that is normal, doing this doesn't seem like a pain to me in any way. My doubt is if is worthy and you say it's not. But why would this be a world of pain? Thanks.
Fabio Milheiro
"You're entering a world of pain"... See http://www.imdb.com/title/tt0118715/
Sayed Ibrahim Hashimi