#3138: Returning a known constructor: GHC generates terrible code for cmonad
-----------------------------------------+----------------------------------
    Reporter:  simonpj                   |        Owner:                  
        Type:  run-time performance bug  |       Status:  new             
    Priority:  normal                    |    Milestone:  6.12 branch     
   Component:  Compiler                  |      Version:  6.10.1          
    Severity:  normal                    |   Resolution:                  
    Keywords:                            |   Difficulty:  Unknown         
    Testcase:                            |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple          |  
-----------------------------------------+----------------------------------
Comment (by simonpj):

 Indeed GHC isn't a supercompiler and doesn't specialise recursive
 functions for their call sites.  As it happens, Peter Jonsson started
 yesterday as an intern to try just that!  But as of today, no.  (Except
 that, perhaps inconsistently, within a single module, we specialise
 overloaded functions (including recursive ones) at the types where they
 are called locally.  You can use a SPECIALISE pragma to make that happen
 for types where there is no local call.)

 Even non-recursive functions are inlined only if they look small enough.
 That can indeed lead to dictionaries being passed instead of code being
 duplicated.

 Meanwhile I'll look at the simpler example -- thanks.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3138#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to