on master help sign in
Use unsafeTail in a few places, for speed
0099c10Bryan O'Sullivan
Data/Text.hs+2−2
@@ -725,7 +725,7 @@ inits t@(Text arr off len) = loop 0
725-- first.
725-- first.
726tails :: Text -> [Text]
726tails :: Text -> [Text]
727tails t | null t = [empty]
727tails t | null t = [empty]
728− | otherwise = t : tails (tail t)
728+ | otherwise = t : tails (unsafeTail t)
729
729
730-- | /O(n)/ Break a 'Text' into pieces separated by the 'Char'
730-- | /O(n)/ Break a 'Text' into pieces separated by the 'Char'
731-- argument, consuming the delimiter. I.e.
731-- argument, consuming the delimiter. I.e.
@@ -821,7 +821,7 @@ breakSubstring pat src = search 0 src
821 search !n !s
821 search !n !s
822 | null s = (src,empty) -- not found
822 | null s = (src,empty) -- not found
823 | pat `isPrefixOf` s = (take n src,s)
823 | pat `isPrefixOf` s = (take n src,s)
824− | otherwise = search (n+1) (tail s)
824+ | otherwise = search (n+1) (unsafeTail s)
825{-# INLINE breakSubstring #-}
825{-# INLINE breakSubstring #-}
826
826
827-- | /O(n)/ 'filter', applied to a predicate and a 'Text',
827-- | /O(n)/ 'filter', applied to a predicate and a 'Text',