Reputation: 1890
We have a quite big ASP.NET MVC site, which takes 6 seconds to display a page. I used Glimpse and MiniProfier, and both told me that the rendering of the view is the culprit (takes 5.9 secs). The control and the view both are called "List".
I removed the entire markup of the _Layout.cshtml and List.cshtml but still the page takes 6 seconds to load! I had a look at global.asax and all the classes in App_start and nothing was wrong there.
When I looked at Glimpse, it said that "ViewResult.ExecuteResult()" was taking 5.9 seconds to run. I assume this method is called to render the view, but I am surprised because there is really nothing to render because I removed all the markups.
Can anyone please direct me as to how can I diagnose this site?
Upvotes: 4
Views: 5288
Reputation: 6089
If we talk about List, I can assume (since we don't have any code) it's generic and IEnumerable. It means that it's lazy-loaded. When you create a list (or get it from somewhere), you don't make actual call to database/external source. But when you access properties, the call is performed, and that's why it takes so long to render the list.
So, the solution is that you don't need to focus on render of the list, but focus on the data source of this list. Where the data comes from? For example, if you use database, may be you must create indexes to improve selection speed of your query.
Upvotes: 3