|
|
|
|
|
by alextingle
4586 days ago
|
|
for (unsigned i = 0; i < N; ++i) {
for (unsigned j = 0; j < i; ++j) {
obj->tick(j);
}
}
I wouldn't go quite so far as to say that benchmarks with tight inner loops like this are completely useless, but they are nearly so.The author is clearly aware that the real world of performance is much bigger & more complex than his simple Petri dish. Credit to him for mentioning that. It's also really refreshing to see him analysing the optimised assembly. The trouble with this approach is that it's tempting to draw simple conclusions. In this case, you might be tempted to conclude "CRTP always faster than virtual dispatch", when the truth is likely to be much more situation dependent. I have seen a biggish project go though a lot of effort to switch to CRTP, only to see a negligible performance impact. |
|