
#7850: Strangely high memory usage on optimized Ackermann function ---------------------------------+------------------------------------------ Reporter: dolio | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Runtime performance bug Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Comment(by dolio): I can't speak for anyone else, but performance here (Linux, 64-bit) is much better with 1M stack chunks as well. Also, with the program I posted recently... It finishes very shortly after running into my swap with the given parameters. With depth=4050, it takes a little over 5 seconds. With depth=4051, it takes a little over 5 seconds. With depth=4052, it takes around 26 seconds. And this is still true on HEAD. Anyhow, the difference is that 4052 has to allocate a second stack chunk on each iteration, and then toss it away almost immediately. This activity dramatically slows down the program. -kc1M makes the same difference for the ackermann example. I wouldn't be surprised if OCaml doesn't have to do any similar fooling on this example (due to a larger initial stack), which is why it would perform comparably to C by default. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7850#comment:27 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler