[GHC] #10528: compile time performance regression with OverloadedStrings and Text

GHC ghc-devs at haskell.org
Fri Jul 24 16:47:25 UTC 2015


#10528: compile time performance regression with OverloadedStrings and Text
-------------------------------------+-------------------------------------
        Reporter:  jakewheat         |                   Owner:  bgamari
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:  7.10.3
       Component:  Compiler          |                 Version:  7.10.2-rc2
      Resolution:                    |                Keywords:
Operating System:  Linux             |            Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Right, so after your second bullet (end of phase 1) we have something
 reasonable (this is for a list with two strings in it):
 {{{
 -- RHS size: {terms: 6, types: 1, coercions: 0}
 a_s3zW :: Text
 [LclId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 120 0}]
 a_s3zW =
   Data.Text.Internal.Fusion.unstream
     (Data.Text.Internal.Fusion.Common.map
        Data.Text.Internal.safe
        (Data.Text.Internal.Fusion.Common.streamList
           @ Char (unpackCString# "abstime"#)))

 -- RHS size: {terms: 6, types: 1, coercions: 0}
 a_s3zY :: Text
 [LclId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 120 0}]
 a_s3zY =
   Data.Text.Internal.Fusion.unstream
     (Data.Text.Internal.Fusion.Common.map
        Data.Text.Internal.safe
        (Data.Text.Internal.Fusion.Common.streamList
           @ Char (unpackCString# "aclitem"#)))

 -- RHS size: {terms: 3, types: 2, coercions: 0}
 a_s3zX :: [Text]
 [LclId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
 a_s3zX = : @ Text a_s3zY ([] @ Text)

 -- RHS size: {terms: 3, types: 1, coercions: 0}
 strings :: [Text]
 [LclIdX,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
 strings = : @ Text a_s3zW a_s3zX
 }}}
 The `unstream/map/safe/streamList` is the result of inlining
 `Data.Text.pack`.  I suppose it's ok to have that much for every literal
 string.

 But then in the next pass (phase 0) we inline `unstream`, which is pretty
 big; and `Data.Text.Internal.Fusion.Common.map` and
 `Data.Text.Internal.safe` and
 `Data.Text.Internal.Fusion.Common.streamList`.

 All of these are inlined because of an INLINE pragma.

 So we are inlining boat-loads of code, under explicit user guidance, but
 for no purpose.  I say this is the fault of the `text` library, not of
 GHC!  What do you ''want'' to happen for literal strings?

 I don't know what has changed.  Has `text` changed?  I think the same
 thing should happen with any version of GHC though I have not tried.

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


More information about the ghc-tickets mailing list