[GHC] #10067: The Read Integer instance is too slow

GHC ghc-devs at haskell.org
Fri Feb 6 04:58:11 UTC 2015


#10067: The Read Integer instance is too slow
-------------------------------------+-------------------------------------
              Reporter:  redneb      |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:
              Priority:  low         |           Version:  7.11
             Component:              |  Operating System:  Unknown/Multiple
  libraries/base                     |   Type of failure:  Runtime
              Keywords:              |  performance bug
          Architecture:              |        Blocked By:
  Unknown/Multiple                   |   Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 The current implementation of the Read Integer instance has quadratic
 complexity and thus performs badly on large inputs. On my system, it takes
 65 seconds to perform the following:
 {{{#!hs
 read (take 1000000 $ cycle "1234567890") :: Integer
 }}}

 Note that we already provide an ad-hoc instance for Show Integer, so maybe
 we can do the same for Read Integer.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10067>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list