[GHC] #13960: Ticks exhausted with 8.0.2
GHC
ghc-devs at haskell.org
Wed Jul 12 15:43: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):
Thanks tom-bop!
What is happening here is that GHC is inlining the guts of `toStrict
(toLazyByteString x)` into each call site of `fromString` (since this is
what `bytestring` requests). In the case that we are calling `fromString`
on a dynamically computed `String` this might make sense since we could
possibly fuse the encoding logic and buffer write into the producer.
However, in this particular case the `String` is a literal (that is,
produced by `unpackCString#`). I really don't think there is any good
reason to inline here. Moreover, in principle `Builder` should handle
string literals with a simple `memcpy`. Unfortunately, it can't currently
do this (easily) since string literals don't have an exposed size and we
treat `'\0'` a bit funnily (encoding it as `'\xC0\x80'`, which the
`memcpy` would need to undo).
Ultimately I think the right solution would be to simply treat literals
properly.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13960#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list