[GHC] #13253: Exponential compilation time with RWST & ReaderT stack with `-02`
GHC
ghc-devs at haskell.org
Tue Oct 2 11:38:38 UTC 2018
#13253: Exponential compilation time with RWST & ReaderT stack with `-02`
-------------------------------------+-------------------------------------
Reporter: phadej | Owner: bgamari, osa1
Type: bug | Status: new
Priority: normal | Milestone: 8.8.1
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: #15630 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by tdammers):
On further investigation, the `MonadIO` constraint is not the one that
makes the specializer blow up; removing the `MonadIO` constraints and
changing `Handler` to `type Handler = IO` retains the blowup. Which leaves
us with the `Semigroup`, `Monoid`, `Functor`, `Applicative` and `Monad`
instances for `FormResult`.
So I implemented non-polymorphic `formMap` and `formAp` to replace `fmap`
and `<*>`, and used `FormSuccess` directly instead of `pure`, allowing me
to delete the `Functor` and `Applicative` instances for `FormResult`.
Things still blow up in the `SpecConst` step, until I add a `NOINLINE
formMap` pragma - and suddenly everything is "fine".
Interestingly, changing the `Monoid` and `Semigroup` instances such that
all methods are implemented in a pathologically trivial way (`mappend x y
= FormMissing`, etc.) doesn't make things faster, so it's not that
specializing on either of those is the problem.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13253#comment:38>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list