I am pretty sure it would be slower
but difference between them would be very small.
MAybe you should do that, whenever you change a value in arrays, recalculate score but you don't have to scan the whole list again. just check the element you are changing. something like
int score;void changeelement(int i, int newvalue){ if(test == goal){ score--; //if they were equal before changing the value decrease the score } test = newvalue; //or goal = newvalue if(test == goal){ score++; //if they are equal after changing the value increase the score }}
but if you recrate the vertices rather than changing single values this would be even slower