@@ -384,20 +384,9 @@ encodeUtf8 (Text arr off len) = unsafeDupablePerformIO $ do
384384 start newSize n m fp'
385385 {-# INLINE ensure #-}
386386 case A.unsafeIndex arr n of
387− w| w <= 0x7F -> ensure 1 $ do
387+ w| w <= 0x7F -> do
388388 poke (ptr `plusPtr` m) (fromIntegral w :: Word8)
389− -- A single ASCII octet is likely to start a run of
390− -- them. We see better performance when we
391− -- special-case this assumption.
392− let end = ptr `plusPtr` size
393− ascii !t !u
394− | t == offLen || u == end || v >= 0x80 =
395− go t (u `minusPtr` ptr)
396− | otherwise = do
397− poke u (fromIntegral v :: Word8)
398− ascii (t+1) (u `plusPtr` 1)
399− where v = A.unsafeIndex arr t
400− ascii (n+1) (ptr `plusPtr` (m+1))
389+ go (n+1) (m+1)
401390 | w <= 0x7FF -> ensure 2 $ do
402391 poke8 m $ (w `shiftR` 6) + 0xC0
403392 poke8 (m+1) $ (w .&. 0x3f) + 0x80