   declare variables or call functions?
  Let's say we have a function that's called very often, like Update() in a game. In Update, I use a variable dt for delta time that the game engine provides me through a function call. In Update(), dt is used many times.Is it better to declare a variable dt in the beginning of Update() every time or call the function from the game engine? Which is more efficient. I guess it's the declaration of the variable...void Update(){const float dt = hge->Timer_GetDelta();for all objects->Update(dt);}orvoid Update(){for all objects->Update(hge->Timer_GetDelta());}
  Yeah generally the first one, as the second one may have the overhead of calling the function many times.In same cases, if the compiler inlines the Timer_GetDelta function (and all it does is return a value), then there may be no difference. Generally though it's faster to 'cache' values like that in local variables.I often do the same thing for the conditions inside for loops, so you're comparing two local variables instead of comparing a variable with a function-return-value. e.g.std::vector<int> vec(42);for( std::vector<int>::iterator i=vec.begin(), e=vec.end(); i != e; ++i ){  std::cout << *i;}