ASP.NET MVC Performance Issues with Render Partial

1

February 12, 2011 by temebele

We were working on optimization effort for a web application that we built recently. After we finished fixing up Select N+1, Caching and other NHibernate related ORM usage issues another thing popped out. Our profiler was actually showing a hot spot on loading partial views, System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String, Object).

RenderPartialView

After doing some research I found this article by Kazi Manzur Rashid. I recommend reading it,http://weblogs.asp.net/rashid/archive/2009/04/23/asp-net-mvc-view-location-and-performance-issue.aspx

  foreach (var viewEngine in ViewEngines.Engines.OfType<VirtualPathProviderViewEngine>())

{

viewEngine.ViewLocationCache =

new DefaultViewLocationCache(TimeSpan.FromHours(24));

}

Another solution will be to put the full path of the ascx file on RenderPartial instead of just the name.

Advertisements

One thought on “ASP.NET MVC Performance Issues with Render Partial

  1. Sosh says:

    This is only a problem when running in debug mode. In release mode the paths to the locations are cached.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: