ASP.NET MVC Performance Issues with Render Partial


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).


After doing some research I found this article by Kazi Manzur Rashid. I recommend reading it,

  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.


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: Logo

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

Google+ photo

You are commenting using your Google+ 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

%d bloggers like this: