3 ms·
AFAIK this is still an active area of research. In principle pure functional programs can be freely parallelized, but in practice it's hard to do it completely
by iainmerrick 9y ago
AFAIK this is still an active area of research.
In principle pure functional programs can be freely parallelized, but in practice it's hard to do it completely automatically without losing more in overheads than you gain through parallelism.
In Haskell I think the standard approach is still to annotate your code, indicating which parts should be evaluated in parallel. See https://wiki.haskell.org/Parallelism https://wiki.haskell.org/Parallelism
- jandrese 9y agoEven if all of your functions are pure they can still have data dependence with one another. So you obviously can't parallelize foo(bar()) automatically. There are other things that can make a real mess of paraellizability too, like error checking. Say you have some code like: comprehend all item in list, verify(item) or errorout("failed at ", stringify(name(item))) The compiler can't auto parallelize it because the exit condition is unknowable, at least if you want there to only be a single exit from the function. You can get around this with even more strict requirements, but after enough of these restrictions even simple tasks start to get hard.