[GHC] #13344: Core string literal patch regresses compiler performance considerably

GHC ghc-devs at haskell.org
Wed Mar 1 09:57:44 UTC 2017


#13344: Core string literal patch regresses compiler performance considerably
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  bgamari
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.1
      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):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 There is a good reason for (2).  Consider
 {{{
 let x = C "foo"#
 in .x..x..x.....case x of { C s -> ...s...s... }....
 }}}
 We'll do case-of-known-constructor on the case expression, binding `s` to
 the component. Ah!  The component is `"foo"#` so we'll duplicate `"foo"#`
 at every occurrence of `s`.

 That is why we do ANF for let-bound constructors.  I think we should
 continue to do so.   (Unless, just possibly, the let-binding has a
 NOINLINE pragma...)

 For (3) I agree.  The only reason to aggressively float literals would be
 for CSE.

 -------------
 More generally, if it is ''really'' the case that these top level bindings
 {{{
 x = "foo#"
 y = C x
 }}}
 take a lot longer to compile (code generate?) than
 {{{
 y = C "foo"#
 }}}
 then I think we should seek insight into ''why''.  There is no good reason
 for it to take longer. Let's not bend ourselves out of shape to
 accommodate what may possibly be an easily-fixed perf bug in the back end.

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


More information about the ghc-tickets mailing list