If you assign twice to the same variable, the compiler will remove the first one. The second assignment would have to at least be dependent on something unknown at compile time. Check the assembly, you should see that there is only one assignment in both cases.
-
This Tweet is unavailable.
-
-
This Tweet is unavailable.
-
You can't run speed tests like that. You have to have full optimizations to see what the compiler will do when it is allowed to optimize properly.
1 reply 0 retweets 1 like -
Replying to @cmuratori
(Although for a test such as the one you are doing, you really should just write the ASM and run it under perf on Linux, that would be my suggestion - because it will be hard to get the compiler to output the right ASM to test what you are trying to test.)
0 replies 0 retweets 1 like -
This Tweet is unavailable.
-
Yes, I checked it, that's why I was concerned. They are not the same ASM except for clears. They are actually quite different, and it's because you are not allowing the optimizing compiler to optimize.
0 replies 0 retweets 1 like -
This Tweet is unavailable.
We can go over this this weekend on @handmade_hero. I can probably get the compiler to output a set of xors plus a dependent movaps, it's usually not that hard if you jiggle the C around a bit :)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.