Why is ONE basic arithmetic operation in for loop body executed SLOWER THAN TWO arithmetic operations?
问题 While I experimented with measuring time of execution of arithmetic operations, I came across very strange behavior. A code block containing a for loop with one arithmetic operation in the loop body was always executed slower than an identical code block, but with two arithmetic operations in the for loop body. Here is the code I ended up testing: #include <iostream> #include <chrono> #define NUM_ITERATIONS 100000000 int main() { // Block 1: one operation in loop body { int64_t x = 0, y = 0;