summaryrefslogtreecommitdiff
path: root/compiler/GHC/Data/StringBuffer.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-02-10 14:19:21 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-22 20:18:11 -0400
commit8336ba78e00ec42521ba8314bc65ec766e6bcc7d (patch)
tree6afd917e80c2efface0e561a1f3673d9fda47f5d /compiler/GHC/Data/StringBuffer.hs
parent1010c33bb8704fa55a82bc2601d5cae2e6ecc21f (diff)
downloadhaskell-8336ba78e00ec42521ba8314bc65ec766e6bcc7d.tar.gz
Pass specialised utf8DecodeChar# to utf8DecodeLazy# for performance
Currently we're passing a indexWord8OffAddr# type function to utf8DecodeLazy# which then passes it on to utf8DecodeChar#. By passing one of utf8DecodeCharAddr# or utf8DecodeCharByteArray# instead we benefit from the inlining and specialization already done for those.
Diffstat (limited to 'compiler/GHC/Data/StringBuffer.hs')
-rw-r--r--compiler/GHC/Data/StringBuffer.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Data/StringBuffer.hs b/compiler/GHC/Data/StringBuffer.hs
index daf599d5e7..11ddfe47bc 100644
--- a/compiler/GHC/Data/StringBuffer.hs
+++ b/compiler/GHC/Data/StringBuffer.hs
@@ -200,7 +200,7 @@ nextChar (StringBuffer buf len (I# cur#)) =
-- Getting our fingers dirty a little here, but this is performance-critical
inlinePerformIO $ do
withForeignPtr buf $ \(Ptr a#) -> do
- case utf8DecodeCharAddr# (a# `plusAddr#` cur#) of
+ case utf8DecodeCharAddr# (a# `plusAddr#` cur#) 0# of
(# c#, nBytes# #) ->
let cur' = I# (cur# +# nBytes#) in
return (C# c#, StringBuffer buf len cur')