#2747: Excessive Memory Usage: space leak with foldl' on Integer
-----------------------------------------+----------------------------------
    Reporter:  guest                     |        Owner:                  
        Type:  run-time performance bug  |       Status:  new             
    Priority:  normal                    |    Milestone:                  
   Component:  Compiler                  |      Version:  6.10.1          
    Severity:  blocker                   |   Resolution:                  
    Keywords:                            |     Testcase:                  
Architecture:  Unknown/Multiple          |           Os:  Unknown/Multiple
-----------------------------------------+----------------------------------
Comment (by nominolo):

 A heap profile shows ARR_WORDS as the culprit.  The compiling the program
 with {{{-O}}} with either version gives an equivalent inner loop:
 {{{
 -- 6.8.2
 Rec {
 Main.lgo :: GHC.Num.Integer -> [GHC.Num.Integer] -> GHC.Num.Integer
 [GlobalId]
 [Arity 2
  NoCafRefs
  Str: DmdType SS]
 Main.lgo =
   \ (z1_aw1 :: GHC.Num.Integer) (ds_aw2 :: [GHC.Num.Integer]) ->
     case ds_aw2 of wild_aw3 {
       [] -> z1_aw1;
       : x_aw7 xs1_aw8 ->
         case GHC.Num.timesInteger z1_aw1 x_aw7 of tpl_awa { __DEFAULT ->
         Main.lgo tpl_awa xs1_aw8
         }
     }
 end Rec }
 }}}
 {{{
 -- HEAD (6.11.20081103)
 Rec {
 Main.lgo :: GHC.Integer.Internals.Integer
             -> [GHC.Integer.Internals.Integer]
             -> GHC.Integer.Internals.Integer
 [GlobalId]
 [Arity 2
  NoCafRefs
  Str: DmdType SS]
 Main.lgo =
   \ (z_ay4 :: GHC.Integer.Internals.Integer)
     (ds_ay5 :: [GHC.Integer.Internals.Integer]) ->
     case ds_ay5 of wild_ay6 {
       [] -> z_ay4;
       : x_aya xs_ayb ->
         case GHC.Integer.timesInteger z_ay4 x_aya of z'_ayd { __DEFAULT ->
         Main.lgo z'_ayd xs_ayb
         }
     }
 end Rec }
 }}}
 My guess therefore is that {{{GHC.Integer.timesInteger}}} is the culprit.

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