#4299: a less forceful INLINE pragma
---------------------------------+------------------------------------------
    Reporter:  simonmar          |        Owner:                            
        Type:  feature request   |       Status:  new                       
    Priority:  normal            |    Milestone:                            
   Component:  Compiler          |      Version:  6.12.3                    
    Keywords:                    |     Testcase:                            
   Blockedby:                    |   Difficulty:  Moderate (less than a day)
          Os:  Unknown/Multiple  |     Blocking:                            
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown              
---------------------------------+------------------------------------------
 The `INLINE` pragmas currently does two things:

  1. it saves an unoptimised definition of the function in the interface
 file, and
  2. it unfolds the definition at (almost) every call site, before
 optimising it further in situ.

 I'm proposing that we have a variant of the `INLINE` pragma that does (1)
 without necessarily unfolding the definition at every call site.  GHC's
 simplifier already has some well-tuned heuristics for deciding whether to
 inline something or not based on information about the context, and when
 we use `INLINE` we bypass all this and potentially end up with unnecessary
 code bloat and maybe even a loss of performance in some cases.

 If we had an `INLINEABLE` pragma that did (1) without forcing (2), then
 the decision about whether to inline or not is deferred to the call site,
 where the user can decide how they want to trade off code size against
 speed.  Right now the user doesn't get to decide - the library writer
 does.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4299>
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