3 ms·
Your answer received lots of votes for what are basically assumptions. The author of the article updated his post for -O3 by using a volatile variable for the
by bad_user 16y ago
Your answer received lots of votes for what are basically assumptions.
The author of the article updated his post for -O3 by using a volatile variable for the for-loop test, which makes the compiler not optimize away the loop.
For .NET you can look at the generated assembly, and if it does optimize away the loop you can use the same trick.
No reasons for guessing. We are software engineers after all.
- JoachimSchipper 16y ago"volatile" forces the C compiler to issue load and store instructions for each access (although real-world C compilers are notoriously buggy here), so it makes the loop much slower. That's not a fair comparison.