
#14594: 2 modules / 2500LOC takes nearly 3 minutes to build -------------------------------------+------------------------------------- Reporter: schyler | Owner: dfeuer Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.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): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): I've looked in a little more detail. The thing I've found most surprising and suspicious is that we end up with absolutely ''enormous'' unfoldings for some dictionaries. For `Data (Maybe Int)`, we get this mouthful: {{{#!hs $s$fDataMaybe_s57H [InlPrag=NOUSERINLINE CONLIKE] :: Data (Maybe Int) [LclId, Unf=DFun: \ -> Data.Data.C:Data TYPE: Maybe Int (base-4.11.0.0:Data.Typeable.Internal.mkTrApp @ * @ * @ Maybe @ Int Data.Data.$fDataMaybe5 Data.Data.$fDataInt4) `cast` (Sym (base-4.11.0.0:Data.Typeable.Internal.N:Typeable[0]) <*>_N <Maybe Int>_N :: (Type.Reflection.TypeRep (Maybe Int) :: *) ~R# (Typeable (Maybe Int) :: Constraint)) \ (@ (c_a5c3 :: * -> *)) (k_a5c4 [Occ=Once!] :: forall d b. Data d => c_a5c3 (d -> b) -> d -> c_a5c3 b) (z_a5c7 [Occ=Once*!] :: forall g. g -> c_a5c3 g) (ds_a5c9 [Occ=Once!] :: Maybe Int) -> case ds_a5c9 of { Nothing -> z_a5c7 @ (Maybe Int) (GHC.Base.Nothing @ Int); Just a1_a5ce [Occ=Once] -> k_a5c4 @ Int @ (Maybe Int) Data.Data.$fDataInt (z_a5c7 @ (Int -> Maybe Int) (GHC.Base.Just @ Int)) a1_a5ce } Data.Data.$fDataMaybe_$cgunfold @ Int Data.Data.$fDataInt \ (ds_a51o [Occ=Once!] :: Maybe Int) -> case ds_a51o of { Nothing -> Data.Data.$cNothing; Just _ [Occ=Dead] -> Data.Data.$cJust } \ _ [Occ=Dead] -> Data.Data.$tMaybe ... ... }}} Why are we inlining method definitions into the dictionary unfolding at all? I'd expect us to wait for someone to pluck a method from the dictionary unfolding and then consider whether to inline the method. Now I don't know if this has anything to do with the problem, but it looks weird. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14594#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler