3 ms·
Agreed. This post doesn't show that the mental model is naive or incorrect. It simply shows that the expense of an operation is not always time. We generally op
by Arnor 12y ago
Agreed. This post doesn't show that the mental model is naive or incorrect. It simply shows that the expense of an operation is not always time. We generally optimize for time and consequently miss the subtlety of expense.
Just because the additional instruction did not take more time (or cycles), doesn't mean it was free. Say there are several instructions any of which can be subbed in for `__builtin_popcountl` and still fit into the same cycle. Several used together may add up and cost a cycle on each round of the loop.
So although the added instruction doesn't cost any additional time. It isn't free.