#876: Length is not a good consumer
--------------------------------+-------------------------------------------
    Reporter:  ariep@…          |       Owner:  simonpj                
        Type:  bug              |      Status:  new                    
    Priority:  lowest           |   Milestone:  7.6.2                  
   Component:  libraries/base   |     Version:  6.5                    
    Keywords:  length           |          Os:  Linux                  
Architecture:  x86              |     Failure:  Runtime performance bug
  Difficulty:  Unknown          |    Testcase:  list003                
   Blockedby:                   |    Blocking:                         
     Related:                   |  
--------------------------------+-------------------------------------------
Changes (by george.colpitts):

  * failure:  None/Unknown => Runtime performance bug


Comment:

 I don't remember explicitly setting Type of failure to None/Unknown when I
 added a keyword of length but it seems I did. I have now changed the
 failure type to runtime performance bug. On ghc 7.4.1 the problem I see is
 that the space usage of  length is O(n) not O(1) in the size of the input,
 perhaps this is a better summary of the bug. I'm assuming that this is
 what "length is not a good consumer" means. This of course also slows down
 execution speed. Given the preceding I'm not sure why priority is lowest.

 {{{
 *Main> length  [0 .. (2^20)]
 1048577
 it :: Int
 (0.03 secs, 42303644 bytes)
 *Main> length  [0 .. (2^30)]
 1073741825
 it :: Int
 (23.08 secs, 42950370096 bytes)
 *Main> 42950370096 / 42303644
 1015.2877160180338
 }}}

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