diff options
| author | Daniel Gröber <dxld@darkboxed.org> | 2019-09-26 20:57:11 +0200 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-07-22 20:18:11 -0400 |
| commit | 1010c33bb8704fa55a82bc2601d5cae2e6ecc21f (patch) | |
| tree | b08836c1dafe6aef94afc14bcf34a31c7cdb783e /compiler/GHC/Data/StringBuffer.hs | |
| parent | 0bf8980ec86cab8d605149bbf47ed2361e2d389e (diff) | |
| download | haskell-1010c33bb8704fa55a82bc2601d5cae2e6ecc21f.tar.gz | |
Use ShortByteString for FastString
There are multiple reasons we want this:
- Fewer allocations: ByteString has 3 fields, ShortByteString just has one.
- ByteString memory is pinned:
- This can cause fragmentation issues (see for example #13110) but also
- makes using FastStrings in compact regions impossible.
Metric Decrease:
T5837
T12150
T12234
T12425
Diffstat (limited to 'compiler/GHC/Data/StringBuffer.hs')
| -rw-r--r-- | compiler/GHC/Data/StringBuffer.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Data/StringBuffer.hs b/compiler/GHC/Data/StringBuffer.hs index 8ac5d1ae07..daf599d5e7 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 utf8DecodeChar# (a# `plusAddr#` cur#) of + case utf8DecodeCharAddr# (a# `plusAddr#` cur#) of (# c#, nBytes# #) -> let cur' = I# (cur# +# nBytes#) in return (C# c#, StringBuffer buf len cur') |
