Skip to content

Optimize GHC.Utils.Monad

Andreas Klebinger requested to merge wip/andreask/inlineable_mapAccumLM into master
Optimize GHC.Utils.Monad.

Many functions in this module are recursive and as such get marked
loop breakers. Which means they do not get an unfolding.

This is *bad*. We always want to specialize them to specific Monads.

I rewrote the recursive ones from:

    foo f x = ... foo x' ...

to

    foo f x = go x
      where
        go x = ...

As well as giving some INLINEABLE pragmas to make all of them available
for specialization.

The end result is a reduction of allocations of about -0.3% for
nofib/spectral/simple/Main.hs compiled at -O0.

Merge request reports