
#7850: Strangely high memory usage on optimized Ackermann function ------------------------------------+--------------------------------------- Reporter: dolio | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime performance bug | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- Comment(by dolio): The benchmarks game used to have an entry called 'recursive' that ran fib, ack and tak.* But it's since disappeared, and isn't one of the entries that was copied into nofib. ack is the only one that displays the pathological behavior by default. I thought tak might, but it didn't. This seems to be related to a shallower stack usage. For instance, tak 60000 30 15 runs comfortably (for a very long time) with -K32K, so it will never overflow the default chunk size. However, one can get tak to eat memory in a similar way by making the stack chunking small enough. For (an extreme) instance -kb25 -kc256, setting the chunk size to 256 bytes, will cause the same memory exhausting behavior. This meshes with nomeata's observations above. Also for reference, I just built 7.6.3, and whatever fixed this in HEAD has not been incorporated into it. It still displays the pathological behavior. ---- [*] tak is defined as follows: {{{ tak x y z | y < x = tak (tak (x-1) y z) (tak (y-1) z x) (tak (z-1) x y) | otherwise = z }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7850#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler