text 0.11.1.5 → 0.11.1.6
raw patch · 6 files changed
+141/−16 lines, 6 filesdep +HUnitdep +QuickCheckdep +directorydep ~bytestringdep ~deepseqPVP ok
version bump matches the API change (PVP)
Dependencies added: HUnit, QuickCheck, directory, random, test-framework, test-framework-hunit, test-framework-quickcheck2
Dependency ranges changed: bytestring, deepseq
API changes (from Hackage documentation)
Files
- Data/Text/Encoding.hs +5/−1
- Data/Text/Lazy/Search.hs +4/−3
- README.markdown +5/−5
- tests/benchmarks/src/Data/Text/Benchmarks.hs +2/−0
- tests/benchmarks/src/Data/Text/Benchmarks/Stream.hs +94/−0
- text.cabal +31/−7
Data/Text/Encoding.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE BangPatterns, ForeignFunctionInterface, MagicHash,+{-# LANGUAGE BangPatterns, CPP, ForeignFunctionInterface, MagicHash, UnliftedFFITypes #-} -- | -- Module : Data.Text.Encoding@@ -48,7 +48,11 @@ ) where import Control.Exception (evaluate, try)+#if __GLASGOW_HASKELL__ >= 702+import Control.Monad.ST.Unsafe (unsafeIOToST, unsafeSTToIO)+#else import Control.Monad.ST (unsafeIOToST, unsafeSTToIO)+#endif import Data.Bits ((.&.)) import Data.ByteString as B import Data.ByteString.Internal as B
Data/Text/Lazy/Search.hs view
@@ -77,10 +77,11 @@ go !(g::Int64) !i !msk !skp | i >= xlast = case xs of Empty -> (msk .|. swizzle z) :*: skp- Chunk y ys -> buildTable y ys g 0 msk skp- | otherwise = go (g+1) (i+1) (msk .|. swizzle c) skp'+ Chunk y ys -> buildTable y ys g 0 msk' skp'+ | otherwise = go (g+1) (i+1) msk' skp' where c = A.unsafeIndex xarr (xoff+i)- skp' | c == z = nlen - fromIntegral g - 2+ msk' = msk .|. swizzle c+ skp' | c == z = nlen - g - 2 | otherwise = skp xlast = xlen - 1 -- | Check whether an attempt to index into the haystack at the
README.markdown view
@@ -19,15 +19,15 @@ # Get involved! Please report bugs via the-[bitbucket issue tracker](http://bitbucket.org/bos/text/issues).+[github issue tracker](https://github.com/bos/text/issues). -Master [Mercurial repository](http://bitbucket.org/bos/text):+Master [git repository](https://github.com/bos/text): -* `hg clone http://bitbucket.org/bos/text`+* `git clone git://github.com/bos/text.git` -There's also a [git mirror](http://github.com/bos/text):+There's also a [Mercurial mirror](https://bitbucket.org/bos/text): -* `git clone git://github.com/bos/text.git`+* `hg clone https://bitbucket.org/bos/text` (You can create and contribute changes using either Mercurial or git.)
tests/benchmarks/src/Data/Text/Benchmarks.hs view
@@ -19,6 +19,7 @@ import qualified Data.Text.Benchmarks.ReadNumbers as ReadNumbers import qualified Data.Text.Benchmarks.Replace as Replace import qualified Data.Text.Benchmarks.Search as Search+import qualified Data.Text.Benchmarks.Stream as Stream import qualified Data.Text.Benchmarks.WordFrequencies as WordFrequencies import qualified Data.Text.Benchmarks.Programs.BigTable as Programs.BigTable@@ -52,6 +53,7 @@ , ReadNumbers.benchmark (tf "numbers.txt") , Replace.benchmark (tf "russian.txt") "принимая" "своем" , Search.benchmark (tf "russian.txt") "принимая"+ , Stream.benchmark (tf "russian.txt") , WordFrequencies.benchmark (tf "russian.txt") ]
+ tests/benchmarks/src/Data/Text/Benchmarks/Stream.hs view
@@ -0,0 +1,94 @@+-- | This module contains a number of benchmarks for the different streaming+-- functions+--+-- Tested in this benchmark:+--+-- * Most streaming functions+--+{-# LANGUAGE BangPatterns #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Data.Text.Benchmarks.Stream+ ( benchmark+ ) where++import Control.DeepSeq (NFData (..))+import Criterion (Benchmark, bgroup, bench, nf)+import Data.Text.Fusion.Internal (Step (..), Stream (..))+import qualified Data.Text.Encoding as T+import qualified Data.Text.Encoding.Error as E+import qualified Data.Text.Encoding.Fusion as T+import qualified Data.Text.Encoding.Fusion.Common as F+import qualified Data.Text.Fusion as T+import qualified Data.Text.IO as T+import qualified Data.Text.Lazy.Encoding as TL+import qualified Data.Text.Lazy.Encoding.Fusion as TL+import qualified Data.Text.Lazy.Fusion as TL+import qualified Data.Text.Lazy.IO as TL++instance NFData a => NFData (Stream a) where+ -- Currently, this implementation does not force evaluation of the size hint+ rnf (Stream next s0 _) = go s0+ where+ go !s = case next s of+ Done -> ()+ Skip s' -> go s'+ Yield x s' -> rnf x `seq` go s'++benchmark :: FilePath -> IO Benchmark+benchmark fp = do+ -- Different formats+ t <- T.readFile fp+ let !utf8 = T.encodeUtf8 t+ !utf16le = T.encodeUtf16LE t+ !utf16be = T.encodeUtf16BE t+ !utf32le = T.encodeUtf32LE t+ !utf32be = T.encodeUtf32BE t++ -- Once again for the lazy variants+ tl <- TL.readFile fp+ let !utf8L = TL.encodeUtf8 tl+ !utf16leL = TL.encodeUtf16LE tl+ !utf16beL = TL.encodeUtf16BE tl+ !utf32leL = TL.encodeUtf32LE tl+ !utf32beL = TL.encodeUtf32BE tl++ -- For the functions which operate on streams+ let !s = T.stream t++ return $ bgroup "Stream"++ -- Fusion+ [ bgroup "stream" $+ [ bench "Text" $ nf T.stream t+ , bench "LazyText" $ nf TL.stream tl+ ]++ -- Encoding.Fusion+ , bgroup "streamUtf8"+ [ bench "Text" $ nf (T.streamUtf8 E.lenientDecode) utf8+ , bench "LazyText" $ nf (TL.streamUtf8 E.lenientDecode) utf8L+ ]+ , bgroup "streamUtf16LE"+ [ bench "Text" $ nf (T.streamUtf16LE E.lenientDecode) utf16le+ , bench "LazyText" $ nf (TL.streamUtf16LE E.lenientDecode) utf16leL+ ]+ , bgroup "streamUtf16BE"+ [ bench "Text" $ nf (T.streamUtf16BE E.lenientDecode) utf16be+ , bench "LazyText" $ nf (TL.streamUtf16BE E.lenientDecode) utf16beL+ ]+ , bgroup "streamUtf32LE"+ [ bench "Text" $ nf (T.streamUtf32LE E.lenientDecode) utf32le+ , bench "LazyText" $ nf (TL.streamUtf32LE E.lenientDecode) utf32leL+ ]+ , bgroup "streamUtf32BE"+ [ bench "Text" $ nf (T.streamUtf32BE E.lenientDecode) utf32be+ , bench "LazyText" $ nf (TL.streamUtf32BE E.lenientDecode) utf32beL+ ]++ -- Encoding.Fusion.Common+ , bench "restreamUtf8" $ nf F.restreamUtf8 s+ , bench "restreamUtf16LE" $ nf F.restreamUtf16LE s+ , bench "restreamUtf16BE" $ nf F.restreamUtf16BE s+ , bench "restreamUtf32LE" $ nf F.restreamUtf32LE s+ , bench "restreamUtf32BE" $ nf F.restreamUtf32BE s+ ]
text.cabal view
@@ -1,7 +1,7 @@ name: text-version: 0.11.1.5-homepage: https://bitbucket.org/bos/text-bug-reports: https://bitbucket.org/bos/text/issues+version: 0.11.1.6+homepage: https://github.com/bos/text+bug-reports: https://github.com/bos/text/issues synopsis: An efficient packed Unicode text type. description: .@@ -40,7 +40,7 @@ copyright: 2009-2011 Bryan O'Sullivan, 2008-2009 Tom Harper category: Data, Text build-type: Simple-cabal-version: >= 1.6+cabal-version: >= 1.8 extra-source-files: README.markdown -- scripts/CaseFolding.txt@@ -137,10 +137,34 @@ cpp-options: -DINTEGER_GMP build-depends: integer >= 0.1 && < 0.2 -source-repository head- type: mercurial- location: https://bitbucket.org/bos/text+test-suite tests+ type: exitcode-stdio-1.0+ hs-source-dirs: . tests/tests/src+ main-is: Data/Text/Tests.hs+ c-sources: cbits/cbits.c + ghc-options:+ -Wall -threaded -O0 -rtsopts++ cpp-options:+ -DASSERTS -DHAVE_DEEPSEQ++ build-depends:+ base >= 4 && < 5,+ bytestring >= 0.9 && < 0.10,+ deepseq >= 1.1 && < 1.2,+ directory >= 1.0 && < 1.2,+ random >= 1.0 && < 1.1,+ QuickCheck >= 2.4 && < 2.5,+ HUnit >= 1.2 && < 1.3,+ test-framework >= 0.4 && < 0.5,+ test-framework-quickcheck2 >= 0.2 && < 0.3,+ test-framework-hunit >= 0.2 && < 0.3+ source-repository head type: git location: https://github.com/bos/text++source-repository head+ type: mercurial+ location: https://bitbucket.org/bos/text