Skip to content
  • takano-akio's avatar
    Mark *FB functions INLINE[0] (Fixes #13001) · 09bce7ac
    takano-akio authored and Ben Gamari's avatar Ben Gamari committed
    When fusion rules successfully fire, we are left with calls to
    *FB functions. They are higher-order functions, and therefore they
    often benefit from inlining. This is particularly important when
    then final consumer is a strict fold (foldl', length, etc.), because
    not inlining these functions means allocating a function closure
    for each element in the list, which often is more costly than what
    fusion eliminates.
    
    Nofib shows a slight increase in the binary size:
    
    ------------------------------------------------------------------------
           Program           Size    Allocs   Runtime   Elapsed  TotalMem
    ------------------------------------------------------------------------
       gen_regexps          -0.3%      0.0%     0.000     0.000      0.0%
            puzzle          +0.8%      0.0%     0.089     0.090      0.0%
           reptile          +0.8%     -0.0%     0.008     0.008      0.0%
    ------------------------------------------------------------------------
               Min          -0.3%     -0.0%     -7.3%     -7.1%      0.0%
               Max          +0.8%     +0.0%     +7.8%     +7.7%     +1.8%
    Geometric Mean          +0.0%     -0.0%     +0.2%     +0.2%     +0.0%
    ------------------------------------------------------------------------
    
    Reviewers: simonpj, austin, hvr, bgamari
    
    Reviewed By: simonpj
    
    Subscribers: simonpj, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2951
    
    GHC Trac Issues: #13001
    09bce7ac