Hello
I was looking for the bottlenect in my game and I find it at a strange place and I wonder why.
So the game is basically a lag test in which I have n circle. The bottleneck was iterating through a small (between 1 and 5 elements) ArrayList n*n time. I was using this code to iterate :
for(int i : list){
//Do something
}
I fix it by using this code :
for(int i=0; i<list.size(); i++){
//Do something
}
So my question is why does it fix it. Is it because with for(int i : list) it creates an Iterator object and that’s what take more time?
