
#11365: Worse performance with -O -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: optimization | performance concurrency Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): The "state hack" seems to be responsible here. Without `-O`, the argument to `replicateM_` is shared and therefore the expensive computation occurs only once. With `-O`, `replicateM_` is inlined and then due to the "state hack" GHC thinks it is okay to duplicate the expensive computation. Try building with `-fno-state-hack`. I made other small adjustments to the program in testing; you may also need `-fno-full-laziness`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11365#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler