8 ms·
I had commented in a previous discussion regarding Haskell that a common criticism of Haskell is that it’s lazy evaluation can lead to problems reasoning about
by travmatt 7y ago
I had commented in a previous discussion regarding Haskell that a common criticism of Haskell is that it’s lazy evaluation can lead to problems reasoning about runtime performance, a criticism which is repeated here. I wonder if there any resources, whether language specific tooling, or general theory, that could help developers struggling with this. I suppose that flame graphs would be a useful tool to see where your time is being spent.
- joppy 7y agoThe Haskell runtime itself helps out here! Compiling the program in “profiling” mode supplies a large number of runtime switches so that you can profile performance, space usage over time, and so on. It’s not perfect, but it’s much more than many languages give you built-in. https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html https://downloads.haskell.org/~ghc/latest/docs/html/users_gu... It also gives you the ability to “tag” sections of code for profiling, so if you suspect that the internals of some named function are giving you grief, you simply add a tag (some pragma comment thing I think) and get profiling information for it. It’s much quicker than having to refactor just to profile sections of code.
- rotifer 7y agoOver the years I've collected various links on topics related to Haskell performance. I'll spare you the whole list, but here are a few that may be of some use. Haskell Performance Patters - Johan Tibell (2012) http://johantibell.com/files/haskell-performance-patterns.html#(1) http://johantibell.com/files/haskell-performance-patterns.ht... Performance (Haskell Wiki) https://wiki.haskell.org/Performance https://wiki.haskell.org/Performance Detecting Space Leaks - Neil Mitchell (2015) http://neilmitchell.blogspot.com/2015/09/detecting-space-leaks.html http://neilmitchell.blogspot.com/2015/09/detecting-space-lea... The Haskell performance checklist - Chris Done, et. al. (2017 - 2019) https://github.com/haskell-perf/checklist/blob/master/README.md https://github.com/haskell-perf/checklist/blob/master/README... ThreadScope (Haskell Wiki) https://wiki.haskell.org/ThreadScope https://wiki.haskell.org/ThreadScope Top tips and tools for optimising Haskell - Will Sewell (2015) https://making.pusher.com/top-tips-and-tools-for-optimising-haskell/ https://making.pusher.com/top-tips-and-tools-for-optimising-...
- srik 7y agoI’m in a Haskell learning phase and honestly can’t get enough recommended study pointers. Share as many as you feel comfortable sharing, there’s always some like me who’d benefit from the curation.
- Eugeleo 7y agoNot the OC and (mostly) not related to Haskell performance, but the following could be useful to you: State of Haskell Ecosystem: https://github.com/Gabriel439/post-rfc/blob/master/sotu.md#compilers https://github.com/Gabriel439/post-rfc/blob/master/sotu.md#c... Guide to Haskell (2018): https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated-guide-to-haskell-in-2018/ https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated... Haskell learner milestones: https://stackoverflow.com/a/1016986 https://stackoverflow.com/a/1016986 GHC optimizations (rather advanced, but interesting): https://stackoverflow.com/questions/12653787/what-optimizations-can-ghc-be-expected-to-perform-reliably https://stackoverflow.com/questions/12653787/what-optimizati... Compilation of various Haskell tutorials on more advanced topics: https://markkarpov.com/learn-haskell.html https://markkarpov.com/learn-haskell.html Despite the popular saying, there’s a wealth of knowledge about Haskell beyond just academic papers, and in digestable form, but it’s scattered around little-known blogs. I’d recommend you to check out r/haskell from time to time, or subscribe to the Haskell newsletter - at least for me, those are the places where I got to know most of Haskell blogs.
- pjmlp 7y agoSimon Marlow's book is also good source of information "Parallel and Concurrent Programming in Haskell" https://simonmar.github.io/pages/pcph.html https://simonmar.github.io/pages/pcph.html He also has some interesting articles like https://simonmar.github.io/posts/2018-06-20-Finding-fixing-space-leaks.html https://simonmar.github.io/posts/2018-06-20-Finding-fixing-s...
- jose_zap 7y agoThe article does not blame lazy evaluation for the problem. The author just could not figure out where the leaks came from. I believe I know where some of the leaks may be coming from. I’m one of the authors of hadolint, the docker file linter. We used ShellCheck as a library to lint the bash code found inside the files. When we attempted to compile Hadolint to Javascript to embed it on a web page, we discovered that the code in ShellCheck was not optimal. The culprit for our use case was the abuse of regular expressions for checking equality of bash snippets. In Haskell, most regexp libraries interface with external C libraries and have pinned memory objects for performance, but one must be careful not to accumulate too many of them. The solution for us to have a usable Javascript version was to reimplement the equality operator for those cases we needed, and now memory usage was down again. We haven’t stumbled upon our first space leak yet.
- eru 7y agoIf you can, get Don Stewart to help you.