This is a migrated thread and some comments may be shown as answers.

[Solved] sitemap performance

4 Answers 72 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christian
Top achievements
Rank 1
Christian asked on 21 Feb 2011, 11:25 AM

I'm using the panel bar to bind a sitemap like demonstrated on the demos page: http://demos.telerik.com/aspnet-mvc/panelbar/sitemapbinding

But when rendering the sitemap with the following code it takes about 6 seconds


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%
    Html.Telerik().PanelBar()
       .Name("SiteMapPanelBar")
       .BindTo("sitemap")
       .Render();
%>

(the same problem exists with TreeView instead of PanelBar)

The Action Method itself executes fast

public partial class NavigationController : Controller
{
    public const string SiteMapFile = "~/Web.sitemap";
    public const string SiteMapName = "siteMap";
    public const string SiteMapKey = "siteMap";
 
    [PopulateSiteMap(SiteMapName = SiteMapName, ViewDataKey = SiteMapKey)]
    public virtual ActionResult SiteMap()
    {
        if (!SiteMapManager.SiteMaps.ContainsKey(SiteMapKey))
        {
            SiteMapManager.SiteMaps.Register<XmlSiteMap>(SiteMapKey, sitmap => sitmap.LoadFrom(SiteMapFile));
        }
 
        return View();
    }
}

Has someone encountered the same problem and/or knows what the problem could be and how to solve it?

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 21 Feb 2011, 11:46 AM
Hello Fabiano,

We are not familiar with such performance issue. Could you please provide a simple test project which reproduces the depicted problem? Thus we will be able to investigate it locally and advice you further. 

Regards,
Georgi Krustev
the Telerik team
0
Christian
Top achievements
Rank 1
answered on 21 Feb 2011, 02:44 PM
Hi Georgi Krustev

Here is an example project

Thanks and regards
Fabiano
0
Christian
Top achievements
Rank 1
answered on 22 Feb 2011, 10:34 AM
Ok, I just found out that adding Spring.Web.Mvc.dll to the references causes this issue. Even though it is never used in the program.
0
Georgi Krustev
Telerik team
answered on 22 Feb 2011, 11:51 AM
Hello Fabiano,

 
Thank for the attached sample.

After further investigation it looks out that Spring.Web.Mvc.dll is the issue. In this case PanelBar UI component will check for each node and its children if they are accessible. Thus "Security trimming" feature works in this case.  IsAccessible() method will get all controllers and action attributes in order to check item accessibility. You probably guessed already that combination of application in Debug mode and reference to the Spring.Web.Mvc.dll will cause this performance issue, because retrieved attributes are not cached.

If you need to better performance I will suggest you test in release mode. Nevertheless we will further investigate this issue and will try to find better solution for this problem. Probably will always cache controllers attributes.

Regards,
Georgi Krustev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
PanelBar
Asked by
Christian
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Christian
Top achievements
Rank 1
Share this question
or