Skip to content
Snippets Groups Projects
Commit c71b2204 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Improvements in SpecConstr

* Allow under-saturated calls to specialise
  See Note [SpecConstr call patterns]
  This just allows a bit more specialisation to take place.

* Don't discard calls from un-specialised RHSs.  This was
  a plain bug in `specialise`, again leading to loss of
  specialisation.  Refactoring yields an `otherwise`
  case that is easier to grok.

* I refactored CallPat to become a proper data type, not a tuple.

All this came up when I was working on eta-reduction.  The ticket
is #19672.

The nofib results are mostly zero, with a couple of big wins:

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
         awards          +0.2%     -0.1%    -18.7%    -18.8%      0.0%
  comp_lab_zift          +0.2%     -0.2%    -23.9%    -23.9%      0.0%
           fft2          +0.2%     -1.0%    -34.9%    -36.6%      0.0%
            hpg          +0.2%     -0.3%    -18.4%    -18.4%      0.0%
           mate          +0.2%    -15.7%    -19.3%    -19.3%    +11.1%
         parser          +0.2%     +0.6%    -16.3%    -16.3%      0.0%
         puzzle          +0.4%    -19.7%    -33.7%    -34.0%      0.0%
        rewrite          +0.2%     -0.5%    -20.7%    -20.7%      0.0%
--------------------------------------------------------------------------------
            Min          +0.2%    -19.7%    -48.1%    -48.9%      0.0%
            Max          +0.4%     +0.6%     -1.2%     -1.1%    +11.1%
 Geometric Mean          +0.2%     -0.4%    -21.0%    -21.1%     +0.1%

I investigated the 0.6% increase on 'parser'.  It comes because SpecConstr
has a limit of 3 specialisations.  With HEAD, hsDoExpr has 2
specialisations, and then a further several from the specialised
bodies, of which 1 is picked.  With this patch we get 3
specialisations right off the bat, so we discard all from the
recursive calls.  Turns out that that's not the best choice, but there
is no way to tell that.  I'm accepting it.

NB: these figures actually come from this patch plus the preceding one for
StgCSE, but I think the gains come from SpecConstr.
parent 7bd12940
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment