Quantcast
Viewing all articles
Browse latest Browse all 22228

With the -Ofast flag on gcc, does breaking down a math expression affect speed?

i want to know whether, with the -Ofast flag on gcc, the code

x += (a * b) + (c * d) + (e * f);

is faster/slower/the same as/than this code:

x += a * b;x += b * c;  x += e * f;

I have a math expression like this inside of a nested loop so any gain in speed might have a significant effect.


Viewing all articles
Browse latest Browse all 22228

Trending Articles