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

GHC ghc-devs at haskell.org
Wed Mar 28 00:16:42 UTC 2018


#14208: Performance with O0 is much better than the default or with -O2, runghc
performs the best
-------------------------------------+-------------------------------------
        Reporter:  harendra          |                Owner:  osa1
            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):

 @mpickering is there something to read about how things do and don't get
 optimized with CPS especially with GHC? What are the pitfalls and why it
 does not optimize well? I am very much interested in this, any pointers
 will be appreciated. I was using the direct style before and I had some
 trouble with it, I had to use a lot of SPECIALIZE to IO types to extract
 decent performance wherever I was using monad polymorphic instances. The
 performance did not seem to be much better compared to CPS. Maybe I am
 wrongly attributing the problem to CPS-vs-Direct style and it might have
 been something stupid that I did, at that time. But I never had any
 similar problem in CPS style and then I never went back to direct.

 Though I want to try and see if direct would be any better but it will
 take some time and effort to do that. However, there is some proof that
 direct style is not very much different in that the "streaming" library
 performance is more or less the same as this library and "streaming" is
 actually more or less the same thing but written in direct style. See the
 performance comparison between "streaming" and "streamly" here:

 https://github.com/composewell/streaming-
 benchmarks/blob/master/charts-1/CheaperOperations.svg

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


More information about the ghc-tickets mailing list