4 ms·
F# defines a parallel map with the same type signature as sequential map, but you have to ask for Array.Parallel.map rather than Array.map or whatever, because
by sterlind 2y ago
F# defines a parallel map with the same type signature as sequential map, but you have to ask for Array.Parallel.map rather than Array.map or whatever, because of the possibility of side effects. Only in a pure language like Haskell could you safely parallelize automatically. I'm not sure why Haskell doesn't - maybe overhead?
- recursivecaveat 2y agoI think it's pretty much impossible to tell statically whether you're going to be drowning in overhead spinning up a thread for every pixel on the screen, or leaving tons of parallelism on the table. Maybe with PGO it can be made to work. Even if it could be automatic, parallelism can be so important, and usually requires explicit design to enable, you probably don't want to delegate it.