4 ms·
Interesting analysis, but in what ways can we realistically affect the instructions used without involving assembly?
by cm3 10y ago
Interesting analysis, but in what ways can we realistically affect the instructions used without involving assembly?
- linkregister 10y agoPerhaps writing longer functions would cause the compiler to use more registers, since it needs to keep track of more variables. Though I think this is not the point. I think the author was just pointing this out as an interesting exercise rather than a call to action. The hottest 5 instructions for the call to std::fill were generated by the compiler that inexplicably didn't end up using a rep (or variant) instruction. But we don't know if in this case, fewer x86_64 instructions profiles faster or slower.
- greglindahl 10y agoCompilers routinely inline code, even between source files. Programmers don't need to stress about that. And I don't think REP is ever the fastest, although it's sometimes the shortest code.