Skip to content
  • batterseapower's avatar
    Give a unfolding argument discount proportional to the number of available arguments · dfe536be
    batterseapower authored
    Ensures that h1 gets inlined into its use sites in cases like:
    
    """
    h1 k = k undefined undefined undefined
            undefined undefined undefined
            undefined undefined undefined
            undefined undefined undefined
            undefined undefined undefined
            undefined undefined undefined
    
    a = h1 (\x _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ -> x)
    b = h1 (\_ x _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ -> x)
    """
    
    I've benchmarked this on nofib (albeit recompiling only the
    benchmarks, not the library) and it hardly shifts the numbers - binary
    size is up by 0.1% at most (average 0.0%) and the worst-case
    allocation increase is 0.2% (best case -0.1%, 0.0% average).
    
    If you also rebuild the libraries with this change, the only further
    change is a +0.2% allocation increase in cacheprof. So this looks like
    a pretty low-risk change that will considerably benefit certain
    programs.
    dfe536be