on master help sign in
Improve performance of strict uncons by ~5%
commit9b5ffb318988ba7619c543e8e6aabbbf6d1d0420 authorBryan O'Sullivan <bos@serpentine.com> dateTue 22 Dec 2015, 12:16 (11 years ago) parent406deb4
1 file changed+2−2
Data/Text.hs+2−2
Data/Text.hs+2−2
@@ -485,8 +485,8 @@ head t = S.head (stream t)
485485uncons :: Text -> Maybe (Char, Text)
486486uncons t@(Text arr off len)
487487 | len <= 0 = Nothing
488− | otherwise = Just (c, text arr (off+d) (len-d))
489− where Iter c d = iter t 0
488+ | otherwise = Just $ let !(Iter c d) = iter t 0
489+ in (c, text arr (off+d) (len-d))
490490{-# INLINE [1] uncons #-}
491491
492492-- | Lifted from Control.Arrow and specialized.