I'm coding a game for iphone in c, and after running into some performance problems I decided to use instruments to check where the bottlenecks are, and I found out that casts of literals are not being optimized.
For example:
if(x == (float)3) {....}
runs faster if I write it like this:
if(x == 3.0f) {....}
Why isn't that optimized by the compiler?
I'm using gcc in release mode.
Soooorry, as the comments said, I looked at the object code and is the same.
Xcode instruments gives you line by line the amount of time spent, I see it's not 100% reliable.