When i\'m trying to optimize my code, I often run into a dilemma:
I have an expression like this:
int x = 5 + y * y; int z = sqrt(12) + y * y;
You don't need a temporary variable:
int z = y * y; int x = z + 5 z = z + sqrt(12);
but the only way to be sure if this is (a) faster and (b) truly where you should focus your attention, is to use a profiler and benchmark your entire application.