4 ms·
For inner loops etc., having less branch prediction misses or none at all can actually outweigh having to do slightly more complex calculations. http://stackov
by neumann_alfred 14y ago
For inner loops etc., having less branch prediction misses or none at all can actually outweigh having to do slightly more complex calculations.
http://stackoverflow.com/a/11227902 http://stackoverflow.com/a/11227902
- bane 14y agoI'm actually curious about the internals of how a modern OOP system works internally once it's boiled down to the CPU level. I'd imagine there's still lots of branch prediction issues in complex OOP systems.
- neumann_alfred 14y agoWell, that you don't use OOP for those inner loops is kinda taken for granted I think. That is, you certainly don't program for code beauty first and foremost -- OOP may not hurt in a particular case, but if it does, code beauty may have to go... example: http://www.particleincell.com/2012/memory-code-optimization/ http://www.particleincell.com/2012/memory-code-optimization/ (which is not about OOP per se, and not about branching, but illustrating that knowing what the CPU actually does (not just what it did decades ago) is really important when talking about performance)