2 ms·
That line of reasoning may have been ok 2 decades ago, but the current CPU model isn’t necessarily serial either, anymore. Sure, you can express nigh everythin
by kaba0 5y ago
That line of reasoning may have been ok 2 decades ago, but the current CPU model isn’t necessarily serial either, anymore.
Sure, you can express nigh everything in C++, but defaults matter — a parallel algorithm may well be in the “worth it to implement” category for Haskell, and be in the “no way that we can make it work” category for some lower level language.
Don’t get me wrong, sure, the memory model of haskell may also not be the best which has probably the biggest performance impact, but I really don’t think that there is as much of a difference between comparable high level languages to haskell, so it can absolutely be a good choice for certain applications.
- charcircuit 5y ago>but the current CPU model isn’t necessarily serial either, anymore. It is still largely serial. If you are concerned about the dependencies of the actual instructions themselves (since the CPU can use this information to execute multiple instructions at the same time) in order to optimize something you will be very concerned about being able to predict / look at / influence the code generation. >a parallel algorithm may well be in the “worth it to implement” category for Haskell >“no way that we can make it work” category for some lower level language. I disagree. It is mainly a matter of having libraries available that makes it easy. If a library was made for Haskell that makes parallel algorithms easy to implement a similar library could be made for C++ or whatever to do the same thing.
- kaba0 5y agoAnd who owns what, when will it be deallocated, etc? Even in rust it is not as comfortable as in a higher level language - it is not accidental that where maximal performance isn’t needed GC-d languages are used predominantly in the industry.
- penteract 5y ago>>a parallel algorithm may well be in the “worth it to implement” category for Haskell >>“no way that we can make it work” category for some lower level language. > I disagree. It is mainly a matter of having libraries available that makes it easy. If a library was made for Haskell that makes parallel algorithms easy to implement a similar library could be made for C++ or whatever to do the same thing. This does not match my experience. Haskell encourages you to write code in a way that makes parallelism much easier and less likely to bite you (pure functions and immutability everywhere). I've added parallelism to Haskell code that was written without really thinking about parallelism by changing 2 important lines (and trivial changes to a few places in the same file). I can't imagine it being that straightforward if the code had been in C++.