[GHC] #7258: Compiling DynFlags is jolly slow

GHC ghc-devs at haskell.org
Tue Oct 24 14:37:35 UTC 2017


#7258: Compiling DynFlags is jolly slow
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  simonpj
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.6.1
      Resolution:                    |             Keywords:  deriving-perf
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 tdammers):

 getLine examples:

 monadic-bind style:

 {{{
 [1 of 1] Compiling D                ( examples/t-10-getline.hs,
 examples/t-10-getline.o )

 ==================== Tidy Core ====================
 Result size of Tidy Core = {terms: 182, types: 231, coercions: 0}

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field10
 field10 =
   \ ds_d1JC ->
     case ds_d1JC
     of _
     { DT ds1_d1JD ds2_d1JE ds3_d1JF ds4_d1JG ds5_d1JH ds6_d1JI ds7_d1JJ
          ds8_d1JK ds9_d1JL ds10_d1JM ->
     ds10_d1JM
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field9
 field9 =
   \ ds_d1Jr ->
     case ds_d1Jr
     of _
     { DT ds1_d1Js ds2_d1Jt ds3_d1Ju ds4_d1Jv ds5_d1Jw ds6_d1Jx ds7_d1Jy
          ds8_d1Jz ds9_d1JA ds10_d1JB ->
     ds9_d1JA
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field8
 field8 =
   \ ds_d1Jg ->
     case ds_d1Jg
     of _
     { DT ds1_d1Jh ds2_d1Ji ds3_d1Jj ds4_d1Jk ds5_d1Jl ds6_d1Jm ds7_d1Jn
          ds8_d1Jo ds9_d1Jp ds10_d1Jq ->
     ds8_d1Jo
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field7
 field7 =
   \ ds_d1J5 ->
     case ds_d1J5
     of _
     { DT ds1_d1J6 ds2_d1J7 ds3_d1J8 ds4_d1J9 ds5_d1Ja ds6_d1Jb ds7_d1Jc
          ds8_d1Jd ds9_d1Je ds10_d1Jf ->
     ds7_d1Jc
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field6
 field6 =
   \ ds_d1IU ->
     case ds_d1IU
     of _
     { DT ds1_d1IV ds2_d1IW ds3_d1IX ds4_d1IY ds5_d1IZ ds6_d1J0 ds7_d1J1
          ds8_d1J2 ds9_d1J3 ds10_d1J4 ->
     ds6_d1J0
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field5
 field5 =
   \ ds_d1IJ ->
     case ds_d1IJ
     of _
     { DT ds1_d1IK ds2_d1IL ds3_d1IM ds4_d1IN ds5_d1IO ds6_d1IP ds7_d1IQ
          ds8_d1IR ds9_d1IS ds10_d1IT ->
     ds5_d1IO
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field4
 field4 =
   \ ds_d1Iy ->
     case ds_d1Iy
     of _
     { DT ds1_d1Iz ds2_d1IA ds3_d1IB ds4_d1IC ds5_d1ID ds6_d1IE ds7_d1IF
          ds8_d1IG ds9_d1IH ds10_d1II ->
     ds4_d1IC
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field3
 field3 =
   \ ds_d1In ->
     case ds_d1In
     of _
     { DT ds1_d1Io ds2_d1Ip ds3_d1Iq ds4_d1Ir ds5_d1Is ds6_d1It ds7_d1Iu
          ds8_d1Iv ds9_d1Iw ds10_d1Ix ->
     ds3_d1Iq
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field2
 field2 =
   \ ds_d1Ic ->
     case ds_d1Ic
     of _
     { DT ds1_d1Id ds2_d1Ie ds3_d1If ds4_d1Ig ds5_d1Ih ds6_d1Ii ds7_d1Ij
          ds8_d1Ik ds9_d1Il ds10_d1Im ->
     ds2_d1Ie
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field0
 field0 =
   \ ds_d1I1 ->
     case ds_d1I1
     of _
     { DT ds1_d1I2 ds2_d1I3 ds3_d1I4 ds4_d1I5 ds5_d1I6 ds6_d1I7 ds7_d1I8
          ds8_d1I9 ds9_d1Ia ds10_d1Ib ->
     ds1_d1I2
     }

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 $trModule1_r1EM
 $trModule1_r1EM = TrNameS "main"#

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 $trModule2_r1Ke
 $trModule2_r1Ke = TrNameS "D"#

 -- RHS size: {terms: 3, types: 0, coercions: 0}
 $trModule
 $trModule = Module $trModule1_r1EM $trModule2_r1Ke

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 $tc'DT1_r1Kf
 $tc'DT1_r1Kf = TrNameS "'DT"#

 -- RHS size: {terms: 5, types: 0, coercions: 0}
 $tc'DT
 $tc'DT =
   TyCon
     9521127001609462311## 17424978011088396301## $trModule $tc'DT1_r1Kf

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 $tcDT1_r1Kg
 $tcDT1_r1Kg = TrNameS "DT"#

 -- RHS size: {terms: 5, types: 0, coercions: 0}
 $tcDT
 $tcDT =
   TyCon
     14693474152448962618## 5168028270650093369## $trModule $tcDT1_r1Kg

 -- RHS size: {terms: 93, types: 82, coercions: 0}
 getlD
 getlD =
   >>=
     $fMonadIO
     (<$> $fFunctorIO (read $fReadInt) getLine)
     (\ field1_aGE ->
        >>=
          $fMonadIO
          (<$> $fFunctorIO (read $fReadInt) getLine)
          (\ field12_aGF ->
             >>=
               $fMonadIO
               (<$> $fFunctorIO (read $fReadInt) getLine)
               (\ field13_aGG ->
                  >>=
                    $fMonadIO
                    (<$> $fFunctorIO (read $fReadInt) getLine)
                    (\ field14_aGH ->
                       >>=
                         $fMonadIO
                         (<$> $fFunctorIO (read $fReadInt) getLine)
                         (\ field15_aGI ->
                            >>=
                              $fMonadIO
                              (<$> $fFunctorIO (read $fReadInt) getLine)
                              (\ field16_aGJ ->
                                 >>=
                                   $fMonadIO
                                   (<$> $fFunctorIO (read $fReadInt)
 getLine)
                                   (\ field17_aGK ->
                                      >>=
                                        $fMonadIO
                                        (<$> $fFunctorIO (read $fReadInt)
 getLine)
                                        (\ field18_aGL ->
                                           >>=
                                             $fMonadIO
                                             (<$> $fFunctorIO (read
 $fReadInt) getLine)
                                             (\ field19_aGM ->
                                                >>=
                                                  $fMonadIO
                                                  (<$> $fFunctorIO (read
 $fReadInt) getLine)
                                                  (\ field20_aGN ->
                                                     return
                                                       $fMonadIO
                                                       (DT
                                                          field1_aGE
                                                          field12_aGF
                                                          field13_aGG
                                                          field14_aGH
                                                          field15_aGI
                                                          field16_aGJ
                                                          field17_aGK
                                                          field18_aGL
                                                          field19_aGM
 field20_aGN)))))))))))



 }}}

 vs. applicative:

 {{{
 [1 of 1] Compiling D                ( examples/t-10-getline-appl.hs,
 examples/t-10-getline-appl.o )

 ==================== Tidy Core ====================
 Result size of Tidy Core = {terms: 160, types: 264, coercions: 0}

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field10
 field10 =
   \ ds_d1Je ->
     case ds_d1Je
     of _
     { DT ds1_d1Jf ds2_d1Jg ds3_d1Jh ds4_d1Ji ds5_d1Jj ds6_d1Jk ds7_d1Jl
          ds8_d1Jm ds9_d1Jn ds10_d1Jo ->
     ds10_d1Jo
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field9
 field9 =
   \ ds_d1J3 ->
     case ds_d1J3
     of _
     { DT ds1_d1J4 ds2_d1J5 ds3_d1J6 ds4_d1J7 ds5_d1J8 ds6_d1J9 ds7_d1Ja
          ds8_d1Jb ds9_d1Jc ds10_d1Jd ->
     ds9_d1Jc
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field8
 field8 =
   \ ds_d1IS ->
     case ds_d1IS
     of _
     { DT ds1_d1IT ds2_d1IU ds3_d1IV ds4_d1IW ds5_d1IX ds6_d1IY ds7_d1IZ
          ds8_d1J0 ds9_d1J1 ds10_d1J2 ->
     ds8_d1J0
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field7
 field7 =
   \ ds_d1IH ->
     case ds_d1IH
     of _
     { DT ds1_d1II ds2_d1IJ ds3_d1IK ds4_d1IL ds5_d1IM ds6_d1IN ds7_d1IO
          ds8_d1IP ds9_d1IQ ds10_d1IR ->
     ds7_d1IO
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field6
 field6 =
   \ ds_d1Iw ->
     case ds_d1Iw
     of _
     { DT ds1_d1Ix ds2_d1Iy ds3_d1Iz ds4_d1IA ds5_d1IB ds6_d1IC ds7_d1ID
          ds8_d1IE ds9_d1IF ds10_d1IG ->
     ds6_d1IC
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field5
 field5 =
   \ ds_d1Il ->
     case ds_d1Il
     of _
     { DT ds1_d1Im ds2_d1In ds3_d1Io ds4_d1Ip ds5_d1Iq ds6_d1Ir ds7_d1Is
          ds8_d1It ds9_d1Iu ds10_d1Iv ->
     ds5_d1Iq
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field4
 field4 =
   \ ds_d1Ia ->
     case ds_d1Ia
     of _
     { DT ds1_d1Ib ds2_d1Ic ds3_d1Id ds4_d1Ie ds5_d1If ds6_d1Ig ds7_d1Ih
          ds8_d1Ii ds9_d1Ij ds10_d1Ik ->
     ds4_d1Ie
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field3
 field3 =
   \ ds_d1HZ ->
     case ds_d1HZ
     of _
     { DT ds1_d1I0 ds2_d1I1 ds3_d1I2 ds4_d1I3 ds5_d1I4 ds6_d1I5 ds7_d1I6
          ds8_d1I7 ds9_d1I8 ds10_d1I9 ->
     ds3_d1I2
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field2
 field2 =
   \ ds_d1HO ->
     case ds_d1HO
     of _
     { DT ds1_d1HP ds2_d1HQ ds3_d1HR ds4_d1HS ds5_d1HT ds6_d1HU ds7_d1HV
          ds8_d1HW ds9_d1HX ds10_d1HY ->
     ds2_d1HQ
     }

 -- RHS size: {terms: 5, types: 12, coercions: 0}
 field0
 field0 =
   \ ds_d1HD ->
     case ds_d1HD
     of _
     { DT ds1_d1HE ds2_d1HF ds3_d1HG ds4_d1HH ds5_d1HI ds6_d1HJ ds7_d1HK
          ds8_d1HL ds9_d1HM ds10_d1HN ->
     ds1_d1HE
     }

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 $trModule1_r1Ey
 $trModule1_r1Ey = TrNameS "main"#

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 $trModule2_r1JQ
 $trModule2_r1JQ = TrNameS "D"#

 -- RHS size: {terms: 3, types: 0, coercions: 0}
 $trModule
 $trModule = Module $trModule1_r1Ey $trModule2_r1JQ

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 $tc'DT1_r1JR
 $tc'DT1_r1JR = TrNameS "'DT"#

 -- RHS size: {terms: 5, types: 0, coercions: 0}
 $tc'DT
 $tc'DT =
   TyCon
     9521127001609462311## 17424978011088396301## $trModule $tc'DT1_r1JR

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 $tcDT1_r1JS
 $tcDT1_r1JS = TrNameS "DT"#

 -- RHS size: {terms: 5, types: 0, coercions: 0}
 $tcDT
 $tcDT =
   TyCon
     14693474152448962618## 5168028270650093369## $trModule $tcDT1_r1JS

 -- RHS size: {terms: 71, types: 115, coercions: 0}
 getlD
 getlD =
   <*>
     $fApplicativeIO
     (<*>
        $fApplicativeIO
        (<*>
           $fApplicativeIO
           (<*>
              $fApplicativeIO
              (<*>
                 $fApplicativeIO
                 (<*>
                    $fApplicativeIO
                    (<*>
                       $fApplicativeIO
                       (<*>
                          $fApplicativeIO
                          (<*>
                             $fApplicativeIO
                             (<$> $fFunctorIO DT (<$> $fFunctorIO (read
 $fReadInt) getLine))
                             (<$> $fFunctorIO (read $fReadInt) getLine))
                          (<$> $fFunctorIO (read $fReadInt) getLine))
                       (<$> $fFunctorIO (read $fReadInt) getLine))
                    (<$> $fFunctorIO (read $fReadInt) getLine))
                 (<$> $fFunctorIO (read $fReadInt) getLine))
              (<$> $fFunctorIO (read $fReadInt) getLine))
           (<$> $fFunctorIO (read $fReadInt) getLine))
        (<$> $fFunctorIO (read $fReadInt) getLine))
     (<$> $fFunctorIO (read $fReadInt) getLine)



 }}}

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


More information about the ghc-tickets mailing list