ghc-prim: Don't allocate a thunk for each unpacked UTF-8 character
authorBen Gamari <bgamari.foss@gmail.com>
Mon, 24 Jul 2017 23:01:58 +0000 (19:01 -0400)
committerBen Gamari <ben@smart-cactus.org>
Mon, 24 Jul 2017 23:12:55 +0000 (19:12 -0400)
commit85a295d5607b5f8015bb3517601ced0d1adc29ef
tree6067fafa5e22c965911a8f24696c28d6620ee9b8
parent897366a012de053fd3558ffb665337287c3df926
ghc-prim: Don't allocate a thunk for each unpacked UTF-8 character

While debugging #14005 I noticed that unpackCStringUtf8# was allocating
a thunk for each Unicode character that it unpacked. This seems hardly
worthwhile given that the thunk's closure will be at least three words,
whereas the Char itself will be only two and requires only a bit of bit
twiddling to construct.

Test Plan: Validate

Reviewers: simonmar, austin

Subscribers: dfeuer, rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3769
libraries/ghc-prim/GHC/CString.hs