Original Post
not that i think this change will make a whole lot of difference in my performance but which is quicker of the following 2 choices:
1)
or
2)
i.e. if i''m making repeated calls to vector is it faster to assign the pointer value to a dummy pointer on each iteration of the loop and make the calls from that dummy/copy. since it''s O(n) with the loop and all does a smallish optimization like this become more significant?
-me
for(unsigned int i = 0; i < gameObjects.size(); i++) {
glPushMatrix()
glTranslatef(gameObjects[i]->pos.x, gameObjects[i]->pos.y, gameObjects[i]->pos.z);
glCallList(gameObjects[i]->model->getDisplayList());
glPopMatrix();
}
for(unsigned int i = 0; i < gameObjects.size(); i++) {
GameObject * object = gameObjects[i];
glPushMatrix()
glTranslatef(gameObject->pos.x, gameObject->pos.y, gameObject->pos.z);
glCallList(gameObject->model->getDisplayList());
glPopMatrix();
}