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

GHC ghc-devs at haskell.org
Sat Sep 22 11:00:35 UTC 2018


#15646: ghci takes super long time to find the type of large fractional number
-------------------------------------+-------------------------------------
        Reporter:  Johannkokos       |                Owner:
                                     |  JulianLeviston
            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:                    |
-------------------------------------+-------------------------------------

Comment (by JulianLeviston):

 > C. Change the representation of Ratio to have an extra constructor that
 represents numbers of the form N / D * 10**E.

 It feels to me that this (C) is the best of the 3 options, probably
 because it's the '''laziest'''. Ideally we don't want to compute anything
 until the last possible moment, I'd reckon.

 As far as I can tell from section 2.5 of the report, the type of '''any'''
 literal where there's an `e` marking the exponent is going to be
 `Fractional a => a`. Can we not short circuit on this, and then keep the
 value as Ratio (ie "c" above) until its actual value is needed?

 I'm a bit curious that computing `time ./inplace/bin/ghc-stage2 -e
 '1e10000000 :: Float'` takes a long time to render `Infinity` but I guess
 this issue would go away when we fix the typechecking bug.

 I don't think choosing '''B''' is really an option because that'd involve
 changing the Haskell report.

 As I'm pretty new, some direction would be good.

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


More information about the ghc-tickets mailing list