[GHC] #10830: maximumBy has a space leak

GHC ghc-devs at haskell.org
Thu Jan 5 20:22:17 UTC 2017


#10830: maximumBy has a space leak
-------------------------------------+-------------------------------------
        Reporter:  NeilMitchell      |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.1
       Component:  Core Libraries    |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1205
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by ekmett):

 I'm okay with switching `maximumBy` and `minimumBy` to `foldl1` for now.
 This would at least fix the stack space regression relative to the
 original `[]` implementation. It'd be a big step in the right direction
 from the status quo.

 If  ''later on'' we can come up with a `foldMap'` or similar alternative
 with palatable semantics we can switch over to that and we should be able
 to retain the stack benefits. This would buy us time to fiddle with the
 semantics and implementation of such a combinator and see how well it can
 optimize.

 Breaking up the fix like this would avoid letting the quest for the
 perfect solution derail us from fixing an annoying regression in a common
 combinator today, and even if the second stage never happened this path
 would still make most consumers happy.

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


More information about the ghc-tickets mailing list