Don't call the same function in a loop over and over