Quote: "Now if the curly brackets of this "if" statement are completly empty "
Sadly this is not the case. I had other code inside the {} that *didn't* cause the slowdown. Some did and some didn't. I isolated the code that was causing it and // it out. After I saw this, I put in the counter to see how many times the condition is being met. It was NEVER being met. And the addition of the counter INSIDE the {} (that was never being executed) caused it to slow down!
I think you may be right about the compiler, but I can't seem to figure out what setting could cause this. I have it set to "optimize for speed".
I have another thought. At every condition, the processor makes a "guess" as to what the answer will be (for the look ahead cache). When it gets to the condition, if it "guessed" wrong, it has to dump the cache and go from there. Perhapse it's "guessing" wrong every time.....?
The code you see is not the original code I was using, but it is exhibits exactly the same problem (with less code). And this code is exactly what I have in my game so I can figure out why it's happening.
Are the laws of logic breaking down here?
The fastest code is the code never written.