How can I use SiteMap more efficiently?

So, on our website we use SiteMap

. For each request, we display some kind of menu and do it SiteMap.RootNode

in a helper function.

Now that I have profiled my site with dotTrace I saw that it was get_RootNode()

taking a long time (about 70-75 milliseconds). But we know what SiteMap

is static. So, I think somehow I SiteMap.RootNode

only get it once in Application_Start

and I get access to this through every request.

So my questions are:

Is my approach correct? How can I do it? Or is there an efficient way that I can useSiteMap.RootNode

Thanks.

+2


a source to share


1 answer


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

I think they are meant to be a simple tool type creation for small websites or whatever.

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 will be able to pull your menu lists from the db in less time taking all the children from the current page id / some form of similar contextual query.



You can (as I was told) split your sitemaps into smaller partialmaps and then drag and drop menu lists from them to improve performance.

If, however, your site has less than 500 pages, I would question the encoding ... is this a custom sitemap? Is the provider pending resource lock or something else?

Do you think you are retrieving data using the xmldocument class instead? (just a thought)

0


a source







All Articles