
#11095: -O0 -g slows GHC down on list literals (compared to -O0 without -g) -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D3001 Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): It appears that a big problem here is in `wrapTicks` in `coreSyn/CorePrep.hs`. In particular, tracing its `go` function like this {{{#!hs go (FloatTick t) (fs, e) = ASSERT(tickishPlace t == PlaceNonLam) pprTrace "mapOL called with" (text "t = " <+> ppr t $$ text "fs = " <+> ppr fs) (mapOL (wrap t) fs, mkTick t e) go other (fs, e) = (other `consOL` fs, e) }}} produces a huge amount of output, showing that the `fs` get deeper and deeper, layering tick on tick on tick at least quadratically. See [http://lpaste.net/2018094287874424832 this paste]. Every step in the fold calls `mapOL (wrap t)` on the (growing) accumulator list. I wonder if it might be possible to find a way to combine these ticks, or drop some of them, instead of layering them arbitrarily deeply. I don't know how many we need. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11095#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler