How much time to compile a view in ASP.NET?

∥☆過路亽.° 提交于 2019-12-10 11:47:10

问题


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:


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 Planning for efficiency early vs Premature optimization



来源:https://stackoverflow.com/questions/3843546/how-much-time-to-compile-a-view-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!