
#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): In the simplifier pass right before the two compilers diverse the code looks something like, {{{ (c_d32a (Data.Text.pack (GHC.Base.build @ GHC.Types.Char (\ (@ b) -> GHC.CString.unpackFoldrCString# @ b "bpchar"#))) (c_d32a (Data.Text.pack (GHC.Base.build @ GHC.Types.Char (\ (@ b) -> GHC.CString.unpackFoldrCString# @ b "bytea"#))) }}} Into this `GHC.Base.build` is inlined, {{{ Considering inlining: build arg infos [ValueArg] interesting continuation RuleArgCtxt some_benefit True is exp: True is work-free: True guidance ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False) ANSWER = YES Inlining done: GHC.Base.build Inlined fn: \ (@ a) (g [Occ=Once!] :: forall b. (a -> b -> b) -> b -> b) -> g @ [a] (GHC.Types.: @ a) (GHC.Types.[] @ a) }}} and then `pack`, {{{ Considering inlining: pack arg infos [NonTrivArg] interesting continuation BoringCtxt some_benefit True is exp: True is work-free: True guidance ALWAYS_IF(arity=0,unsat_ok=False,boring_ok=False) ANSWER = YES Inlining done: Data.Text.pack Inlined fn: \ (x [Occ=Once] :: GHC.Base.String) -> Data.Text.Internal.Fusion.unstream (Data.Text.Internal.Fusion.Common.map Data.Text.Internal.safe (Data.Text.Internal.Fusion.Common.streamList @ GHC.Types.Char x)) }}} which I believe is then supposed to cause this rule to fire, {{{ {-# RULES "TEXT literal" forall a. unstream (S.map safe (S.streamList (GHC.unpackCString# a))) = unpackCString# a #-} }}} Yet this appears not to happen in 7.10.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10528#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler