[GHC] #11095: -O0 -g slows GHC down on list literals (compared to -O0 without -g)

GHC ghc-devs at haskell.org
Sat Jan 28 22:48:31 UTC 2017


#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 scpmw):

 Well, turns out the "elegant" way does actually not work: The intermediate
 source notes get floated up, and we still end up with `O(n^3)` complexity
 at intermediate `wrapTicks` stages. Plus the top-level source note had
 actually been in the list of floats anyway - just at first position, which
 gets applied by `foldr` last. So we were applying all sorts of fine-
 grained ticks on `n` expressions just to get rid of all of them in the
 end.

 phab:D3037 fixes this behaviour of `wrapTicks`. It's rather
 straightforward, really: Instead of using a `foldr` to apply ticks from
 the right, we start at the left and drop ticks immediately when we see
 that they are redundant. This should be `O(n)` for list literals now.

 Sorry for that, rather silly mistake :/

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11095#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list