#4276: -O0 runs in constant space, -O1 and -O2 don't ------------------------+--------------------------------------------------- Reporter: guest | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 6.12.1 | Keywords: optimization space leak Testcase: | Blockedby: Os: Windows | Blocking: Architecture: x86 | Failure: Runtime performance bug ------------------------+--------------------------------------------------- Enabling optimization changes the space complexity of this small program, which seems like a bug. Run the attached program with command line argument equal to 22 or greater.
Description of the program: given a real valued function f, compute the sum f(x_i) over an increasingly finer and finer mesh of sample points. If the new mesh shares points with the old mesh this can be computed somewhat more efficiently by reusing the previous sum. Looking at the Time and Allocation report, it seems like the optimized versions of the program are actually computing the sum 2 ** n times instead of n times. This is probably related to what is causing the space behavior. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4276> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs