Question

I have a secondary DataSource with about 23k entries. The User inputs an ID and gets only 1 Dataset back. If I use:

XPathNavigator test = nav.SelectSingleNode("/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[d:Title = '" + ID + "']", NamespaceManager);

it takes about 8 seconds to return the Node. Is there a better (faster) way?

Was it helpful?

Solution

You can collect all the SharePointListItem_RW nodes in a Dictionary (key would be the title id and the value would be the node that contains the title as id) at the start of your app..

[Memory consumption would not be an issue here since it would hardly cross 1MB]

Then you can select the particular node by using TryGetValue method of Dictionary

The complexity would be O(1) which is fast

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top