Now, Performance issue is a major problem for
.NET developers.
To reduce and achieve the Performance good, please follow the steps.
Step 1 : Need to reduce the unwanted loops for fetching data.
We can replace for loops by hash table to reduce the looping count.
Step 2 : Avoid using more number of threads
Please avoid using more Number of threads and timer controls in our application.
Step 3 : Avoid GC.Collect(Gorbage Collection)
Using GC.Collect() method will refresh the memory but the same time it takes
more percentage of CPU Usage.
Get the value from HashTable collection
1.
Public
void
Get ObjectID(Hastable hshtempdata,string
objectID)
{
ArrayList tempArray = new ArrayList();
String temp=String.Empty;
IDictionaryEnumerator dictEnum = hshtempdata.GetEnumerator();
while (dictEnum.MoveNext())
{
tempArray.Add(dictEnum.Key);
}
foreach (string
key in tempArray)
{
if (key.Equals(objectID))
{
temp = (String) hshtempdata [key];
}
}
2. Public
void Get ObjectID(Hastable hshtempdata ,string
objectID)
{
String temp=String.Empty;
foreach (string
key in hshtempdata.Keys)
{
if (key.Equals(objectID))
{
temp = (String) hshtempdata [key];
}
}
3. Public
void Get ObjectID(Hastable hshtempdata,string
objectID)
{
String temp=String.Empty;
temp = (String) hshtempdata [objectID];
}