[GHC] #7977: Optimization: Shift dropped list heads by coeffecient to prevent thunk generation

GHC ghc-devs at haskell.org
Wed Jun 12 01:53:39 CEST 2013


#7977: Optimization: Shift dropped list heads by coeffecient to prevent thunk
generation
---------------------------------+------------------------------------------
    Reporter:  schyler           |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  7.4.2           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by schyler):

 For any list produced with ranges or comprehensions using ranges, it's
 possible to determine the number of heads dropped. As such, it is thereby
 possible to perform a transformation on this list such that the operation
 is performed in constant time (as opposed to the current linear time).

 The following Prelude functions (all containing _:xs match cases) would
 benefit:[[BR]]
 - tail[[BR]]
 - last[[BR]]
 - length[[BR]]
 - drop[[BR]]
 - (!!)[[BR]]
 [[BR]]
 The work required in heavy high-level analysis of _:xs may outweigh just
 writing specific rules for these transformations. One such high-level
 transformation is outlined in the list comprehension example in the
 ticket.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7977#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list