3 ms·
I think programmers frequently underestimate the kinds of performance gains that can be achieved via memory layout and access pattern optimizations. I do a lot
by jandrewrogers 14y ago
I think programmers frequently underestimate the kinds of performance gains that can be achieved via memory layout and access pattern optimizations. I do a lot of high-performance algorithm design and have frequently seen the case that what looks like a trivial and logically neutral algorithm implementation tweak doubles performance by virtue of having better memory access behaviors. For heavy duty memory access optimization, 10x is not unachievable in some cases.
In my experience designing high-performance algorithms on modern processors, I'd estimate 80% of all performance optimizations are actually memory behavior hacks. Designing better algorithms is another 10% and is harder to do (most software engineers have never designed a genuinely original algorithm). The last 10% is everything else, such as redesigning the code to get closer to saturating all 3 ALUs available on modern cores. (Code hacks to force ALU saturation sounds like it shouldn't do much but I've seen 2x performance gains for some algorithms where the "obvious" implementation tended to serialize over one ALU if you analyze them.)
For high-performance code junkies, memory access optimization is the bread and butter for integer factor performance gains.
- sliverstorm 14y agoI'm not a programmer by trade, but I regularly process chunks of data 10GB or larger. In this context fast vs. slow often means nigh-instant vs. twenty minutes of runtime. In summary, from my experience- I agree. Memory access (also, storage access) is huge. Much bigger than tight loops or logical reduction/optimization.