Home > Uncategorized > ASP.NET MVC Performance Issues with Render Partial

ASP.NET MVC Performance Issues with Render Partial

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.

Advertisement
Categories: Uncategorized
  1. Sosh
    May 15, 2011 at 3:30 pm | #1

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

  1. No trackbacks yet.

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.