
Hi, Where can I find some informations abut memory usage prediction? In C (or C++) while I write code I can predict how much stack space will be used, how much heap space will be used, I can count instructions. I want to see all these things while I'm looking at my code. Is it possible in Haskell? Best regards, Emanuel

The short answer is no. This is Haskell's biggest weakness: it's difficult
to predict space usage.
The longer answer is "kind of" -- you can't exactly intuit it, but the
profiler is easy to use:
http://book.realworldhaskell.org/read/profiling-and-optimization.html
http://www.haskell.org/ghc/docs/7.6.2/html/users_guide/prof-heap.html
The only caveat is you have to reinstall your libraries with profiling
enabled:
http://stackoverflow.com/questions/1704421/cabal-not-installing-dependencies...
(If I've already installed some packages, usually I take the quick and
dirty route and just set library-profiling to True, delete ~/.ghc to clear
the package list, then install my package.)
On Wed, Jul 3, 2013 at 3:14 PM, Emanuel Koczwara
Hi,
Where can I find some informations abut memory usage prediction? In C (or C++) while I write code I can predict how much stack space will be used, how much heap space will be used, I can count instructions. I want to see all these things while I'm looking at my code. Is it possible in Haskell?
Best regards, Emanuel
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Hi Patrick, Dnia 2013-07-03, śro o godzinie 15:20 -0400, Patrick Mylund Nielsen pisze:
The short answer is no. This is Haskell's biggest weakness: it's difficult to predict space usage.
The longer answer is "kind of" -- you can't exactly intuit it, but the profiler is easy to use:
http://book.realworldhaskell.org/read/profiling-and-optimization.html
http://www.haskell.org/ghc/docs/7.6.2/html/users_guide/prof-heap.html
The only caveat is you have to reinstall your libraries with profiling enabled: http://stackoverflow.com/questions/1704421/cabal-not-installing-dependencies...
(If I've already installed some packages, usually I take the quick and dirty route and just set library-profiling to True, delete ~/.ghc to clear the package list, then install my package.)
Thank you for such a quick response. I know all that profiling 'stuff'. So, I will put it this way: is there a chance, that I will be able to predict performance after some time of profiling my code? Best regards, Emanuel

I would say "yes". I haven't had any big problems with space leaks that I
couldn't identify via the profiler, then fix.
I certainly wouldn't look at another language instead of Haskell for this
one reason, unless you really need a specific arena size, and you know
exactly what you want where, in which case you're probably writing an
application that's better suited by a language without a garbage collector,
anyway.
On Wed, Jul 3, 2013 at 3:31 PM, Emanuel Koczwara
Hi Patrick,
Dnia 2013-07-03, śro o godzinie 15:20 -0400, Patrick Mylund Nielsen pisze:
The short answer is no. This is Haskell's biggest weakness: it's difficult to predict space usage.
The longer answer is "kind of" -- you can't exactly intuit it, but the profiler is easy to use:
http://book.realworldhaskell.org/read/profiling-and-optimization.html
http://www.haskell.org/ghc/docs/7.6.2/html/users_guide/prof-heap.html
The only caveat is you have to reinstall your libraries with profiling enabled: http://stackoverflow.com/questions/1704421/cabal-not-installing-dependencies...
(If I've already installed some packages, usually I take the quick and dirty route and just set library-profiling to True, delete ~/.ghc to clear the package list, then install my package.)
Thank you for such a quick response. I know all that profiling 'stuff'. So, I will put it this way: is there a chance, that I will be able to predict performance after some time of profiling my code?
Best regards, Emanuel
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On Thu, Jul 4, 2013 at 2:31 AM, Emanuel Koczwara
So, I will put it this way: is there a chance, that I will be able to predict performance after some time of profiling my code?
The advance that purely functional languages offers is the availing of hitherto unknown, extremely powerful optimizations. Small changes at the level of Haskell source can lead to massive, often unexpected changes in runtime performance. Newcomers often find the "discontinuous" experience disconcerting (and that's not even counting encounters with the type checker). The good news is that once Haskell source gets blender'd into Core, performance becomes far more predictable. Hence, those who care about every last drop of time/space usage read Core and put work into making it more readable. -- Kim-Ee

On Thu, Jul 4, 2013 at 2:20 AM, Patrick Mylund Nielsen < haskell@patrickmylund.com> wrote:
The longer answer is "kind of" -- you can't exactly intuit it, but the profiler is easy to use:
Worth mentioning is that GHC's profiling tools are predicated on a knowledge of graph reduction [1]. [1] To get a leg up on graph reduction, I recommend SPJ and PJ/L's Implementing and Implementation texts: first two links on: http://research.microsoft.com/en-us/um/people/simonpj/Papers/papers.html -- Kim-Ee
participants (3)
-
Emanuel Koczwara
-
Kim-Ee Yeoh
-
Patrick Mylund Nielsen