Iterating performance question
in
Programming Questions
•
3 years ago
I have a question about looping through an array, in Processing but also programming in general.
Lets say I have 2 arrays with large amount of data. I need to loop through them, something like this:
Lets say I have 2 arrays with large amount of data. I need to loop through them, something like this:
- for (int i = 0; i < myArray1.length; i++) {
- for (int j = 0; j < myArray2.length; j++) {
- ...
- }
- }
- int i;
- int j;
- int length1 = myArray1.length;
- int length2 = myArray2.length;
- for (i = 0; i < length1; i++) {
- for (j = 0; j < length2; j++) {
- ...
- }
- }
1