Skip to content
  • Andreas Klebinger's avatar
    6a0cafae
    Optimize GHC.Utils.Monad. · 6a0cafae
    Andreas Klebinger authored
    Many functions in this module are recursive and as such are marked
    loop breakers. Which means they are unlikely to get an unfolding.
    
    This is *bad*. We always want to specialize them to specific Monads.
    Which requires a visible unfolding at the use site.
    
    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 pragmas to make all of them available
    for specialization.
    
    The end result is a reduction of allocations of about -1.4% for
    nofib/spectral/simple/Main.hs when compiled with `-O`.
    6a0cafae
    Optimize GHC.Utils.Monad.
    Andreas Klebinger authored
    Many functions in this module are recursive and as such are marked
    loop breakers. Which means they are unlikely to get an unfolding.
    
    This is *bad*. We always want to specialize them to specific Monads.
    Which requires a visible unfolding at the use site.
    
    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 pragmas to make all of them available
    for specialization.
    
    The end result is a reduction of allocations of about -1.4% for
    nofib/spectral/simple/Main.hs when compiled with `-O`.
Loading