[GHC] #10858: Smaller generated Ord instances

GHC ghc-devs at haskell.org
Wed Sep 9 11:39:15 UTC 2015


#10858: Smaller generated Ord instances
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                   Owner:
            Type:  task              |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:  #9557             |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by nomeata):

 Note that we are calling `compare` in the implementation of `<` for all
 but the last argument. (You might have to scroll to the right to see it).
 In the not uncommon corner case of only one field, we are thus only
 calling `<`, as described in the Note.

 So it seems that for large product types, the default implementation is
 not much worse than the generated, while for data types with few or only
 one field, we should generate dedicated methods. But where is the bound?
 What with datatypes with multiple constructors?

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


More information about the ghc-tickets mailing list