#2439: Missed optimisation with dictionaries and loops
--------------------------------------+-------------------------------------
  Reporter:  rl                       |          Owner:  simonpj         
      Type:  bug                      |         Status:  new             
  Priority:  normal                   |      Milestone:  6.12 branch     
 Component:  Compiler                 |        Version:  6.9             
Resolution:                           |       Keywords:                  
Difficulty:  Unknown                  |             Os:  Unknown/Multiple
  Testcase:                           |   Architecture:  Unknown/Multiple
   Failure:  Runtime performance bug  |  
--------------------------------------+-------------------------------------
Comment (by rl):

 I'm not sure how this translates to the new inliner. This is code that is
 generated now:
 {{{
 Foo.sum' =
   \ (@ a_aj6) ($dNum_aje :: GHC.Num.Num a_aj6) ->
     let {
       lit_skO [Dmd=Just L] :: a_aj6
       [LclId, Str=DmdType]
       lit_skO = GHC.Num.fromInteger @ a_aj6 $dNum_aje Foo.sum'1 } in
     letrec {
       loop_skM [Occ=LoopBreaker] :: a_aj6 -> [a_aj6] -> a_aj6
       [LclId, Arity=2, Str=DmdType SS]
       loop_skM =
         \ (z_afp :: a_aj6) (ds_djs :: [a_aj6]) ->
           case z_afp of z1_XfG { __DEFAULT ->
           case ds_djs of _ {
             [] -> z1_XfG;
             : x_afr xs_afs ->
               loop_skM (GHC.Num.+ @ a_aj6 $dNum_aje z1_XfG x_afr) xs_afs
           }
           }; } in
     \ (xs_afu :: [a_aj6]) -> loop_skM lit_skO xs_afu
 }}}
 Instead of scrutinising the dictionary, we are now calling the method
 selector in every iteration. Is this even worse than before?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2439#comment:6>
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