• simonpj@microsoft.com's avatar
    Tidy up computation of result discounts in CoreUnfold · aff23274
    simonpj@microsoft.com authored
    Mostly this patch is a tidy-up, but it did reveal one inconsistency
    that I fixed.  When computing result discounts for case expressions,
    we were *adding* result-discounts for cases on non-arguments, but
    *picking the one for the max-size branch* for arguments. I think you
    could argue the toss, but it seems neater (and the code is nicer)
    to be consistent (ie always add).  See Note [addAltSize result discounts].
    The nofib results seem fine
            Program           Size    Allocs   Runtime   Elapsed
              boyer          -0.8%     -4.8%      0.06      0.07
             sphere          -0.7%     -2.5%      0.15      0.16
                Min          -0.8%     -4.8%    -19.1%    -24.8%
                Max          -0.5%     +0.0%     +3.4%   +127.1%
     Geometric Mean          -0.7%     -0.1%     -4.3%     -1.3%
    The +127% elapsed is a timing error; I re-ran the same binary and it's
    unchanged from the baseline.
CoreUnfold.lhs 44.4 KB