3 ms·
Just because one particular superscalar processor can calculate the instructions in inner loop of the author's example in parallel doesn't make the general case
by kyberias 12y ago
Just because one particular superscalar processor can calculate the instructions in inner loop of the author's example in parallel doesn't make the general case incorrect: adding instructions typically makes the program slower. I think the author is not fair here.
- Arnor 12y agoAgreed. 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.