#4306: UNPACK can lead to unnecessary copying and wasted stack space
---------------------------------+------------------------------------------
    Reporter:  Olathe            |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Component:  Compiler               
     Version:  6.12.3            |    Keywords:                         
    Testcase:                    |   Blockedby:                         
          Os:  Unknown/Multiple  |    Blocking:                         
Architecture:  Unknown/Multiple  |     Failure:  Runtime performance bug
---------------------------------+------------------------------------------
Changes (by Olathe):

 * cc: Olathe (added)


Comment:

 I don't know much about compilers, so feel free to disregard this
 completely.  I thought of a nice, probably simple, optimization pass.

 With each unused argument (the argument can be replaced with an
 underscore) in an unexported function (it is only visible in the current
 `.hs` file),
  * Find out whether it is easy to remove those arguments from each call.
    * If partial application ever stops short of the argument, it's too
 hard.  For example, if the shortest partial application of an arity-26
 function is of the form `f a b c`, the first 3 are considered easy and the
 last 23 are hard.
  * If it is easy, delete the argument from each call site, and delete the
 argument from the function definition.

 Such an optimization pass would solve this bug (since it is very easy in
 this case) and optimize other code for free.

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