[GHC] #7206: Implement cheap build

GHC ghc-devs at haskell.org
Wed Mar 7 15:18:07 UTC 2018


#7206: Implement cheap build
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  simonpj
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  ⊥
       Component:  Compiler          |              Version:  7.4.2
      Resolution:                    |             Keywords:  FloatOut
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #8763, #13422     |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 I confirmed that this fixes #8763. I had not encountered this in practice
 myself, but I was surprised to see this function used in another bug
 report:

 {{{
 ireplicateA_ :: Applicative m => Int -> (Int -> m a) -> m ()
 ireplicateA_ cnt0 f =
     loop cnt0 0
   where
     loop !cnt !n
       | cnt <= 0  = pure ()
       | otherwise = f n *> (loop (cnt - 1) (n + 1))
 }}}

 when I tried using `forM_ [1 .. n] ...` instead of this function I
 realized that the program gets much slower. However with `cheapBuild` the
 generated code is identical. I'll submit a patch with cheap build later
 today with a perf test.

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


More information about the ghc-tickets mailing list