[GHC] #14208: Performance with O0 is much better than the default or with -O2, runghc performs the best

GHC ghc-devs at haskell.org
Tue Sep 12 02:04:44 UTC 2017


#14208: Performance with O0 is much better than the default or with -O2, runghc
performs the best
-------------------------------------+-------------------------------------
        Reporter:  harendra          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      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):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by harendra):

 > my guess would be that when all functions are inlined (e.g., everything
 is placed in the same module) or when none get inlined, performance is
 good,

 That seems to be a correct observation. When everything is in the same
 module the simplifier can choose to inline any of the functions while when
 they are in different modules only those functions that are marked
 INLINE/INLINABLE get inlined. This is supported by the fact that when we
 mark the `toList` function INLINE the difference is eliminated to a large
 extent. Also, it does not go away with `-fexpose-all-unfoldings` but it
 goes away with `-fspecialise-aggressively`. I also suspect that there is
 an interaction of `foldr/build` fusion with the simplifier.

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


More information about the ghc-tickets mailing list