views:

73

answers:

1

So, in our website we are using SiteMap. For each request we render some menu and to do that we do SiteMap.RootNode in the helper function.

Now, when I have done the profiling of my website using dotTrace, I saw the get_RootNode() is taking lot's of time(around 70-75 millisecond). But we know that the SiteMap is static. So, I am thinking in somehow I will get the SiteMap.RootNode only once in Application_Start and will access that through out each request.

So, my questions are,

Is my approach correct? How should I do that? Or is there any efficient way that I can use SiteMap.RootNode

Thanks.

A: 

I have avoided sitemaps for exactly this reason. They are ok up to a few hundred pages but beyond that performance will start to degrade.

I think they are meant to be a simple getting started type tool for smaller web sites or something.

I wrote my own cms and in theory if you are using a similar cms / app that structures the data in the same way you should be able to pull your menu listings from the db in less time by getting all children of the current page id / some form of similar context based query.

You can (as i am told) however break down your sitemaps in to smaller partial maps then pull the menu listings from those to increase performance.

If however your site has less than 500 pages I would question the coding ... is it a custom sitemap? Is the provider waiting for resource locks or something?

Have you considered pulling the data using the xmldocument class instead? (just a thought)

Wardy