Probably trivial speed/memory question.
in
Programming Questions
•
2 years ago
Just out of curiosity, is there any difference speed/memory wise between something like:
Also probably it wouldn't create any noticeable difference to the user, so this question is mostly just theoretical.
- for (int i=0; i<entities.size(); i++) {
- Entity e=entities.get(i);
- e.doStuff(); etc;
- }
- Entity e;
- for (int i=0; i<entities.size(); i++) {
e=entities.get(i); - e.doStuff();
- }
Also probably it wouldn't create any noticeable difference to the user, so this question is mostly just theoretical.
1