Note we are talking about game dev now.
I frequently read here people recommending to:
- stay away from for each loops because they are not cached
- pool objects rather than delete them because of the negative impact of garbage collection.
I am creating a 60 fps game(desktop) and uses lots of for each loops every frame as well as creating new/nullifying objects frequently.
Never noticed any slowdowns even if I flood my map with entities.
So my question is, are people overreacting in regards to this? Maybe the JIT-compiler is caching for each iteratables and GC may not have the performance penalty we think?