3 ms·
> Instead of just reading both blocks again, which is what a compiler would do. We have better compilers than that already. If you have a static data flow, the
by marcosdumay 11y ago
> Instead of just reading both blocks again, which is what a compiler would do.
We have better compilers than that already. If you have a static data flow, there's no reason your compiler can not take it into account when optimizing your code.
Optimizing a dynamic data flow is the hard one (still possible, but not done in practice), but people suck at this too.
- vardump 11y ago> We have better compilers than that already. If you have a static data flow, there's no reason your compiler can not take it into account when optimizing your code. That's right, but this is not about static data flow. This is about choosing a particular strategy for execution and caching a small amount of data in registers to maximize usefulness of cache by having less "hot memory". This reduces expensive memory traffic, which is very often the bottleneck. More generally, you can often do significant part of the work in other lane, but can't communicate this efficiently to somewhere else, because it might be executing simultaneously. So you have to for example access memory unnecessarily or do extra computation for little benefit. When you can control execution order, this is not an issue anymore. I know how amazing compilers are nowadays, but I have never seen any of them optimizing this type of case.