public void Update() { int bucketListCount; int count = occupiedBucket.Count(); for (int i = 0; i < count; i++) { bucketListCount = bucketList[occupiedBucket.ElementAt(i)].Count(); for (int j = 0; j < bucketListCount; j++) { for (int k = j + 1; k < bucketListCount; k++) { bucketList[occupiedBucket.ElementAt(i)].ElementAt(j).handleCollide(bucketList[occupiedBucket.ElementAt(i)].ElementAt(k)); } } } }
There are a lot of uses of elementAt(), would that cause the slowdown to happen? the function it calls inside of itself (handlecollide) isnt spending any time in it so it is all just in the for statements. There has to be a better way to code this. Bucketlist count is usually around 3 or 4 and count is around 200-300.
thanks guys,
[Edited by - EdBoon on November 29, 2010 9:02:32 PM]