[GHC] #5218: Add unpackCStringLen# to create Strings from string literals

GHC ghc-devs at haskell.org
Thu Apr 6 02:02:59 UTC 2017


#5218: Add unpackCStringLen# to create Strings from string literals
-------------------------------------+-------------------------------------
        Reporter:  tibbe             |                Owner:  thoughtpolice
            Type:  feature request   |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.0.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #5877 #10064      |  Differential Rev(s):  Phab:D2443
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by winter):

 If i remember correctly, a `ByteArray#` would have an extra header and a
 length field, which in turn bring a 2 words overhead, one word more
 compareing to the `(# int#, addr# #)` solution. But i would argue this
 overhead can bring a nice solution to ghc's long lasting literal problem,
 for example, `vector` package and `text` package can provide some TH to
 directly save some `byteArray#` literal using hexadecimal notation, this
 save many extra copying during runtime.

 Finally, by nature of binary loading, this `ByteArray#` is pinned, so we
 can still get its address without trouble.

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


More information about the ghc-tickets mailing list