#1969: enormous compile times
------------------------------------------+---------------------------------
 Reporter:  duncan                        |          Owner:                    
     Type:  compile-time performance bug  |         Status:  new               
 Priority:  normal                        |      Milestone:  6.8.3             
Component:  Compiler                      |        Version:  6.8.1             
 Severity:  normal                        |     Resolution:                    
 Keywords:  performance                   |     Difficulty:  Difficult (1 week)
 Testcase:                                |   Architecture:  Multiple          
       Os:  Multiple                      |  
------------------------------------------+---------------------------------
Comment (by igloo):

 This program:
 {{{
 main :: IO ()
 main = writeFile "W.hs" $ unlines $ map unlines foo

 foo :: [[String]]
 foo = [ "module J where",
         "class C a where",
         "    c :: a -> String",
         "    d :: a -> String",
         "    d x = c x",
         "    e :: a -> String",
         "    e x = c x"
       ] :
       [ ["data " ++ d ++ " = " ++ d,
          "instance C " ++ d ++ " where",
          "    c " ++ d ++ " = \"" ++ d ++ "\""]
         | i <- [1..1000],
           let d = 'A' : show i
       ]
 }}}
 generates a `W.hs` with lots of instances like
 {{{
 data A24 = A24
 instance C A24 where
     c A24 = "A24"
 }}}
 Compiling with
 {{{
 ghc -fforce-recomp -O -c W.hs +RTS -p
 }}}
 this is the interesting bit of the profile:
 {{{
                                                               individual
 COST CENTRE              MODULE              no.    entries  %time %alloc
        specProgram       Specialise         8794        2006   0.0    0.0
         specBind         Specialise         8804        6006   0.0    0.0
          splitUDs        Specialise         8883        2002   3.1    4.0
           elemVarSet     VarSet             9174     1998000   0.1    0.2
           listToCallDetails Specialise      8985     2000002   1.0    2.3
            unionCalls    Specialise         9182     1998000  31.1   37.6
             tcCmpType    Type               9186    57864047   9.3    0.0
           intersectsVarSet VarSet           8885     4006001   0.2    0.0
 }}}
 The number of entries for the last 5 grows quadratically with the number
 of instances.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1969#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to