[GHC] #10788: performance regression involving minimum (and maybe Vector)

GHC ghc-devs at haskell.org
Sun Aug 23 19:08:44 UTC 2015


#10788: performance regression involving minimum (and maybe Vector)
-------------------------------------+-------------------------------------
        Reporter:  rwbarton          |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by nomeata):

 In 7.8, both `minimum` and `sum` were non-fusing left-folds. In 7.10,
 `sum`, via `foldl`, is fusing, so this is the 5× improvement you observe.
 `minimum` is not easily foldable: It is a `foldl1`, which treats the first
 `(:)` different from the rest, and it is not clear how to fix that.

 So performance difference between `minimum` and `sum` in 7.10 can be
 explained. What needs to be investigated is why 7.10 degraded by 50% over
 7.8. I do not expect Call Arity/foldl fusion to play a role here, but I
 might be wrong.

 BTW: One could reasonably expect the compiler to transform `minimum
 (x:xs)` into `foldl' min x xs`, which could then maybe fuse, but that does
 not seem to be the case.

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


More information about the ghc-tickets mailing list