[GHC] #13960: Ticks exhausted with 8.0.2

GHC ghc-devs at haskell.org
Tue Jul 11 21:34:17 UTC 2017


#13960: Ticks exhausted with 8.0.2
-------------------------------------+-------------------------------------
        Reporter:  tom-bop           |                Owner:  (none)
            Type:  bug               |               Status:  infoneeded
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 So it looks like the issue here is that `Query`'s `fromString` instance
 inlines:
 {{{
 Inlining done: Database.PostgreSQL.Simple.Types.$fIsStringQuery_g
     Inlined fn:  \ (x [Occ=Once] :: GHC.Base.String) ->
                    let {
                      cs :: Data.ByteString.Lazy.Internal.ByteString
                      [LclId]
                      cs
                        = Data.ByteString.Builder.toLazyByteString
                            (src<libraries/base/GHC/Base.hs:1115:19-23>
 src<libraries/bytestring/Data/ByteString/Builder.hs:450:1-44>
 Data.ByteString.Builder.Prim.primMapListBounded
                               @ GHC.Types.Char
 (src<libraries/bytestring/Data/ByteString/Builder.hs:450:35-44>
                                Data.ByteString.Builder.Prim.charUtf8)
                               (src<libraries/base/GHC/Base.hs:1115:22> x))
 } in
                    src<libraries/base/GHC/Base.hs:1115:1-23>
 src<libraries/bytestring/Data/ByteString/Lazy.hs:(285,1)-(316,37)>
                    Data.ByteString.Lazy.toStrict_goLen0
 (src<libraries/bytestring/Data/ByteString/Lazy.hs:285:26-27> cs) cs
 }}}
 We then eventually inline `primMapListBounded`, which is itself a very
 large function. The simplifier is then force to crunch through all of
 this.

 The most surprising part of all of this is that in the end the `Builder`
 essentially iterates over the list produced by `unpackCString# "query"#`
 and painstakingly fills the target buffer byte-by-byte. Surely something
 has gone terribly wrong here.

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


More information about the ghc-tickets mailing list