4 ms·
These questions often depend on how much time you are willing to spend making things fast. OCaml has an extremely predictable performance curve, which is nice w
by jlouis 11y ago
These questions often depend on how much time you are willing to spend making things fast. OCaml has an extremely predictable performance curve, which is nice when you are writing code that has to run fast. In turn, productivity is good because you don't get into situations where you have to rewrite code to make it faster in many cases. Even for brute-force algorithms, it tend to run fast enough that it would work well.
Over F#, OCaml provides a module system. This helps programming in the very large.
Over Haskell, OCaml provides a module system, and strict evaluation. The latter is a contended point, but proponents of OCaml claim it leads to memory/execution predictability. In Haskell (GHC) you often have to turn on optimizations in order to understand how your code will perform in reality, whereas byte-code interpreted OCaml acts just like natively compiled OCaml space wise, but is roughly 10 times faster in execution speed.
- ics 11y agoHey but GHC just got -XStrict! https://github.com/ghc/ghc/commit/46a03fbec6a02761db079d1746532565f34c340f https://github.com/ghc/ghc/commit/46a03fbec6a02761db079d1746...
- TuringTest 11y agoBut will idiomatic Haskell work with that option turned on? Genuine question. Wouldn't it change the require programming style to make use of the strict setting?
- ics 11y agoCurrently you can deal with strictness using Bang Patterns. The addition of Strict and StrictData with -XStrict simply lets module writers cut down on that noise and communicates intent. It isn't meant to change or split the language Haskell in two; except for testing, you probably wouldn't go enabling it everywhere just 'cause. More info on strictness and Bang Patterns: https://wiki.haskell.org/Performance/Strictness#Explicit_strictness https://wiki.haskell.org/Performance/Strictness#Explicit_str... This was posted to r/haskell today and helps explain things a bit: http://blog.johantibell.com/2015/11/the-design-of-strict-haskell-pragma.html http://blog.johantibell.com/2015/11/the-design-of-strict-has...
- thesz 11y agoStrict evaluation order is less composable. It is less expressive, actually.