[GHC] #15646: ghci takes super long time to find the type of large fractional number

GHC ghc-devs at haskell.org
Sun Sep 16 09:23:04 UTC 2018


#15646: ghci takes super long time to find the type of large fractional number
-------------------------------------+-------------------------------------
        Reporter:  Johannkokos       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  GHCi              |              Version:  8.4.3
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by osa1):

 * keywords:  type => newcomer


Comment:

 It seems like adding one more digit in the literal causes 10x increase in
 desugaring + type checking time:

 {{{
 ~ $ echo ':t 1e10000000' | time ghci
 ...
 ghci  0,37s user 0,04s system 97% cpu 0,418 total

 ~ $ echo ':t 1e100000000' | time ghci
 ...
 ghci  3,63s user 0,12s system 99% cpu 3,749 total

 ~ $ echo ':t 1e1000000000' | time ghci
 ...
 ghci  43,77s user 1,68s system 100% cpu 45,429 total
 }}}

 I also tried compiling this

 {{{#!haskell
 a = 1e1000000000
 }}}

 and it also takes forever. I suspect this is a type checker bug or a
 desugarer bug.

 I think this would be a good newcomer ticket. I'd start with finding how
 the expression `1e1000000000` parsed, and then find relevant desugarer and
 type checker code. Then add some print statements around those code to
 which one takes so long.

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


More information about the ghc-tickets mailing list