I am coding a game for iphone in c, and faced with some performance issues, I decided to use tools to check where the bottlenecks are, and I found out that sheets of literals are not optimized.
For instance:
if(x == (float)3) {....}
works faster if I write it like this:
if(x == 3.0f) {....}
Why is this not optimized by the compiler?
I am using gcc in release mode.
source
share