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

GHC ghc-devs at haskell.org
Fri Jul 24 16:23:36 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 bgamari):

 It appears that inlining is occurring where there previously was none. For
 instance, each top-level bindings under 7.10.1 produces (in `-ddump-
 simpl`),
 {{{#!hs
 T10528.strings181 :: Text
 [GblId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 50 0}]
 T10528.strings181 =
   text-1.2.1.1:Data.Text.Show.unpackCString# "abstime"#
 }}}

 Whereas in 7.10.2 we get this,
 {{{#!hs
 T10528.strings_dt62 :: [Char]
 [GblId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 50 0}]
 T10528.strings_dt62 = unpackCString# "abstime"#

 Rec {
 -- RHS size: {terms: 220, types: 125, coercions: 9}
 T10528.strings476 [InlPrag=[0], Occ=LoopBreaker]
   :: forall s1_a3V7.
      Data.Text.Array.MArray s1_a3V7
      -> Int
      -> [Char]
      -> Int#
      -> State# s1_a3V7
      -> (# State# s1_a3V7, Text #)
 [GblId, Arity=5, Str=DmdType <L,U(U)><L,U(U)><S,1*U><L,U><L,U>]
 T10528.strings476 = ...
 end Rec }


 -- RHS size: {terms: 2, types: 0, coercions: 0}
 T10528.strings121 :: Int
 [GblId,
  Caf=NoCafRefs,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
 T10528.strings121 = I# 4#

 -- RHS size: {terms: 14, types: 15, coercions: 0}
 T10528.strings475
   :: forall s1_a3V7. State# s1_a3V7 -> (# State# s1_a3V7, Text #)
 [GblId,
  Arity=1,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 83 0}]
 T10528.strings475 =
   \ (@ s1_a3V7) (s2_a3V8 [OS=OneShot] :: State# s1_a3V7) ->
     case newByteArray# @ s1_a3V7 8# s2_a3V8
     of _ [Occ=Dead] { (# ipv_a3Vu, ipv1_a3Vv #) ->
     T10528.strings476
       @ s1_a3V7
       (Data.Text.Array.MArray @ s1_a3V7 ipv1_a3Vv)
       T10528.strings121
       T10528.strings_dt62
       0#
       ipv_a3Vu
     }

 -- RHS size: {terms: 2, types: 1, coercions: 0}
 T10528.strings474 :: Text
 [GblId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 20 0}]
 T10528.strings474 = runSTRep @ Text T10528.strings475
 }}}

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


More information about the ghc-tickets mailing list