Opened 9 years ago

Closed 9 years ago

#4007 closed bug (fixed)

Look again at eta expansion during gentle simplification

Reported by: simonmar Owned by: igloo
Priority: normal Milestone: 7.0.1
Component: Compiler Version: 6.13
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case: T4007
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Today I noticed that sequence_ . replicate was not being optimised in the HEAD, and Simon and I tracked it down to sequence_ not being inlined, which was a result of it not being eta-expanded early. This patch reverted to the 6.12.x behaviour:

Fri Apr 23 05:48:53 PDT 2010  Simon Marlow <marlowsd@gmail.com>
  * reinstate eta-expansion during SimplGently, to fix inlining of sequence_

We might want to revisit this before 6.14.1.

The effects on nofib follow:

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed
--------------------------------------------------------------------------------
           anna          -0.7%     -0.0%      0.14      0.14
           ansi          -0.8%     +0.2%      0.00      0.00
           atom          -0.9%     +0.0%     +0.6%     +1.4%
         awards          -0.8%     +0.1%      0.00      0.00
         banner          -0.7%     -0.1%      0.00      0.00
     bernouilli          -0.8%     +0.0%     +0.0%     -0.3%
         boyer2          -0.7%     -0.0%      0.01      0.01
           bspt          -0.7%     -0.0%      0.01      0.01
      cacheprof          -0.8%     -0.1%     +0.7%     +6.2%
       calendar          -0.9%     +0.0%      0.00      0.00
       cichelli          -0.7%     -0.0%      0.12      0.13
        circsim          -0.9%     +0.0%     -0.1%     -0.2%
       clausify          -0.8%     +0.0%      0.05      0.05
  comp_lab_zift          -0.7%     -0.0%     -0.5%     +0.0%
       compress          -0.7%     -0.0%     -0.8%     -1.0%
      compress2          -0.8%     -0.0%    +11.0%    +12.5%
    constraints          -0.9%     +0.0%     +0.8%     +1.0%
   cryptarithm1          -0.8%     -0.0%     +0.5%     +0.1%
   cryptarithm2          -0.8%     -0.0%      0.01      0.02
            cse          -0.8%     -0.2%      0.00      0.00
          eliza          -0.7%     -0.0%      0.00      0.00
          event          -0.7%     -0.0%     -3.9%     -0.3%
         exp3_8          -0.9%     +0.0%      0.16      0.17
         expert          -0.9%     -0.1%      0.00      0.00
            fem          -0.7%     -0.0%      0.03      0.04
            fft          -0.7%     -0.0%      0.04      0.05
           fft2          -0.7%     -0.0%      0.09      0.10
       fibheaps          -1.1%     +0.0%      0.04      0.04
           fish          -0.7%     -0.1%      0.02      0.02
          fluid          -0.7%     +4.7%      0.01      0.01
         fulsom          -0.8%     -0.0%     +0.9%     -0.2%
         gamteb          -0.7%     -0.0%      0.12      0.13
            gcd          -0.8%     -0.0%      0.03      0.03
    gen_regexps          -0.8%     -0.1%      0.00      0.00
         genfft          -0.7%     -0.0%      0.05      0.05
             gg          -0.8%     -0.0%      0.01      0.02
           grep          -0.9%     -0.1%      0.00      0.00
         hidden          -0.8%  (stdout)  (stdout)  (stdout)
            hpg          -0.9%     -1.4%     +0.6%     +2.6%
            ida          -0.7%     +0.0%      0.14      0.15
          infer          -0.7%     -0.0%      0.06      0.07
        integer          -0.9%     +0.0%     -0.6%     -0.3%
      integrate          -0.9%     -0.0%     +2.5%     +3.0%
        knights          -0.9%     -0.0%      0.01      0.01
           lcss          -0.9%     +0.0%     +0.3%     +0.9%
           life          -0.8%     -0.0%     -0.4%     +0.0%
           lift          -0.7%     -0.0%      0.00      0.00
      listcompr          -0.7%     -0.0%      0.14      0.15
       listcopy          -0.7%     -0.0%      0.15      0.15
       maillist          -0.8%     -0.4%      0.08      0.12
         mandel          -0.7%     +0.0%      0.16      0.16
        mandel2          -0.8%     -0.0%      0.01      0.01
        minimax          -0.7%     -0.0%      0.00      0.00
        mkhprog          -0.9%     -0.3%      0.00      0.00
     multiplier          -0.8%     -0.0%      0.15      0.16
       nucleic2          -0.7%     -0.0%      0.10      0.10
           para          -0.9%     -0.0%     -4.8%     -4.5%
      paraffins          -0.9%     -0.0%      0.12      0.14
         parser          -0.7%     -0.0%      0.04      0.05
        parstof          -0.6%     -0.0%      0.00      0.01
            pic          -0.7%     -0.0%      0.01      0.01
          power          -0.8%     -0.0%     +1.1%     +1.1%
         pretty          -0.8%     -0.0%      0.00      0.00
         primes          -0.9%     +0.0%      0.07      0.08
      primetest          -0.8%     +0.0%     -0.5%     +0.3%
         prolog          -0.7%     -0.1%      0.00      0.00
         puzzle          -0.7%     -0.0%     -0.5%     +3.7%
         queens          -0.9%     -0.0%      0.02      0.03
        reptile          -0.7%     +0.7%      0.02      0.02
        rewrite          -0.8%     -0.0%      0.02      0.02
           rfib          -0.9%     +0.4%      0.06      0.06
            rsa          -0.8%     -0.0%      0.12      0.12
            scc          -0.8%     -0.2%      0.00      0.00
          sched          -0.7%     -0.0%      0.02      0.03
            scs          -0.8%     +0.7%     -1.0%     -1.0%
         simple          -0.7%     -0.0%     +2.0%     +1.7%
          solid          -0.7%     -0.0%      0.20      0.21
        sorting          -0.8%     -0.1%      0.00      0.00
         sphere          -0.9%     -7.8%      0.14      0.14
         symalg          -0.7%     +0.1%      0.04      0.04
            tak          -0.9%     +2.6%      0.02      0.02
      transform          -0.7%     +0.0%     +2.0%     +2.1%
       treejoin          -0.9%     -0.0%     -2.7%     +0.2%
      typecheck          -0.7%     -0.0%     +0.4%     -0.2%
        veritas          -0.6%     +0.0%      0.00      0.00
           wang          -0.7%     +0.0%      0.12      0.14
      wave4main          -0.7%     +0.0%     +2.5%     +2.2%
   wheel-sieve1          -0.9%     +0.0%     -2.2%     -2.7%
   wheel-sieve2          -0.9%     +0.0%     +4.9%     +3.1%
           x2n1          -0.8%     -0.0%      0.03      0.03
--------------------------------------------------------------------------------
            Min          -1.1%     -7.8%     -4.8%     -4.5%
            Max          -0.6%     +4.7%    +11.0%    +12.5%
 Geometric Mean          -0.8%     -0.0%     +0.4%     +1.1%

compress2 might be worth a look.

Change History (2)

comment:1 Changed 9 years ago by simonpj

Owner: set to igloo

The HEAD is fine. Heres's a test program

module Main where

main = sequence_ (replicate 10 (putStrLn "yes"))

When compiled with -O -dump-rule-firings, you should see

Rule fired: unpack
Rule fired: Class op >>
Rule fired: Class op return
Rule fired: <=#
Rule fired: fold/build
Rule fired: unpack-list

The foldr/build is the important one.

Ian, could you add a test?

Simon

comment:2 Changed 9 years ago by igloo

Resolution: fixed
Status: newclosed
Test Case: T4007

Test added

Note: See TracTickets for help on using tickets.