Cache the size of the vector instead of calling .size() all over the place.