[GHC] #7994: Make foldl into a good consumer

GHC ghc-devs at haskell.org
Mon Mar 10 12:56:03 UTC 2014


#7994: Make foldl into a good consumer
-------------------------------------+------------------------------------
        Reporter:  simonpj           |            Owner:
            Type:  bug               |           Status:  closed
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.6.3
      Resolution:  fixed             |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by nomeata):

 JFTR: I’m currently working on a presentation and short paper on this, and
 did some measurements, and found that while making `foldl` a good consumer
 has a nice effect on allocations (`-4.1%`, the overall effect on the
 runtime is negligible).

 Effect of Call Arity (with the original foldl):
 {{{
                          min    mean     max
       Allocations      -1.3%   -0.1%    0.0%
       Runtime         -10.8%   -0.9%   +2.0%
 }}}
 Effect of Call Arity + defining foldl with foldr:
 {{{
                          min    mean     max
       Allocations     -74.5%   -4.1%    0.0%
       Runtime         -10.4%   -0.9%   +1.7%
 }}}
 (Wishful thinking: Maybe there are real-world programs that would benefit
 more noticeably, but they are just not included in nofib)

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


More information about the ghc-tickets mailing list