G
Guest
Hi Everyone,
For Last a few weeks I have been involved with performance tuning of an
application. I have observed that if I do a loop over a collection
(ArrayList/HashTable) which has 50000 objects in one shot then it takes about
15 minutes to do the computation. But if I break this to loop of only 5000
objects and do all computation in 10 loops of 5000 each then it takes about 1
minutes 30 seconds.
I am trying to find a reason for this but I haven't been able to get one. If
I do a search on net then it becomes more confusing as some will say don't
use ForEach while some would say use only ForEach. I don't know which advice
to take.
(I have tried using For loop also but result is some what the same).
The loop code look like:
foreach(MyClass obj in listcollection)
{
// do something with this obj.
}
Can someone throw some light on the possible reasons for above mentioned
observations.
Thanks in advance,
AMar.
For Last a few weeks I have been involved with performance tuning of an
application. I have observed that if I do a loop over a collection
(ArrayList/HashTable) which has 50000 objects in one shot then it takes about
15 minutes to do the computation. But if I break this to loop of only 5000
objects and do all computation in 10 loops of 5000 each then it takes about 1
minutes 30 seconds.
I am trying to find a reason for this but I haven't been able to get one. If
I do a search on net then it becomes more confusing as some will say don't
use ForEach while some would say use only ForEach. I don't know which advice
to take.
(I have tried using For loop also but result is some what the same).
The loop code look like:
foreach(MyClass obj in listcollection)
{
// do something with this obj.
}
Can someone throw some light on the possible reasons for above mentioned
observations.
Thanks in advance,
AMar.