#3736: GHC specialising instead of inlining
-------------------------+--------------------------------------------------
    Reporter:  guest     |        Owner:  igloo                  
        Type:  bug       |       Status:  new                    
    Priority:  normal    |    Milestone:  7.0.1                  
   Component:  Compiler  |      Version:  6.10.4                 
    Keywords:            |     Testcase:                         
   Blockedby:            |   Difficulty:                         
          Os:  Linux     |     Blocking:                         
Architecture:  x86       |      Failure:  Runtime performance bug
-------------------------+--------------------------------------------------
Changes (by simonpj):

  * owner:  => igloo


Comment:

 I looked again at this. The HEAD is slower than 6.12 because we have
 {{{
 {-# INLINE arguments2 #-}
 arguments2 :: (a -> b -> x) -> a -> b -> x
 arguments2 f a b = (f $! a) $! b

 ...let go = arguments2 $ \p i -> \x -> blah
 }}}
 In 6.12, `arguments2` would inline regardless of the number of arguments,
 whereas in HEAD things marked INLINE only inline when they have as many
 args as are on the LHS in the source program.  So we need
 {{{
 {-# INLINE arguments2 #-}
 arguments2 :: (a -> b -> x) -> a -> b -> x
 arguments2 f = \ a b -> (f $! a) $! b
 }}}
 I think this is overall an improvement in control, but you do have to be
 careful.  With that change the HEAD is just as fast either way round.
 Here are user times in seconds:
 {{{
                6.12          7.0
 ------------------------------------
 ./T3736 1      1.84          0.32
 ./T3736 2      0.32          0.32
 }}}
 I don't know whether it's worth making a performance-regression test to
 make sure the original problem doesn't re-surface.  Ian, you decide!

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3736#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to