3 ms·
How much of an issue is this really though? Isn't the worst case a 1 cycle penalty for using a 32-bit int on x86-64 in the manner described in the article?
by ryuuchin 10y ago
How much of an issue is this really though?
Isn't the worst case a 1 cycle penalty for using a 32-bit int on x86-64 in the manner described in the article?
- deleted 10y ago[deleted]
- witty_username 10y agoBut that's repeated in the loop. So, looks like around a 10-20% performance change. Quite a bit for something not obvious.
- brigade 10y agoThe worst case is extending the counter each time it's changed, which is once per loop. It's not going to be a measurable difference unless the loop is tight enough to take like 3 cycles per iteration or less.
- ryuuchin 10y agoPerhaps in a really tight loop but the counter is still going to be several iterations ahead thanks to the out of order capabilities of the CPU. You may also have other things in play as well such as the micro-op cache depending on the code size of the loop.