on master help sign in
Make the benchmarks subtree saner
0922578Bryan O'Sullivan
Data/Text/Lazy/Fusion.hs+5−3
@@ -47,6 +47,8 @@ stream text = Stream next (text :*: 0) unknownSize
47 where Iter c d = iter t i
47 where Iter c d = iter t i
48{-# INLINE [0] stream #-}
48{-# INLINE [0] stream #-}
49
49
50+data UC s = UC s {-# UNPACK #-} !Int
51+
50-- | /O(n)/ Convert a 'Stream Char' into a 'Text', using the given
52-- | /O(n)/ Convert a 'Stream Char' into a 'Text', using the given
51-- chunk size.
53-- chunk size.
52unstreamChunks :: Int -> Stream Char -> Text
54unstreamChunks :: Int -> Stream Char -> Text
@@ -59,12 +61,12 @@ unstreamChunks chunkSize (Stream next s0 len0)
59 Done -> Empty
61 Done -> Empty
60 Skip s' -> outer s'
62 Skip s' -> outer s'
61 Yield x s' -> I.Text arr 0 len `chunk` outer s''
63 Yield x s' -> I.Text arr 0 len `chunk` outer s''
62− where (arr,(s'',len)) = A.run2 fill
64+ where (arr, UC s'' len) = A.run2 fill
63 fill = do a <- A.new unknownLength
65 fill = do a <- A.new unknownLength
64 unsafeWrite a 0 x >>= inner a unknownLength s'
66 unsafeWrite a 0 x >>= inner a unknownLength s'
65 unknownLength = 4
67 unknownLength = 4
66 inner marr len s !i
68 inner marr len s !i
67− | i + 1 >= chunkSize = return (marr, (s,i))
69+ | i + 1 >= chunkSize = return (marr, UC s i)
68 | i + 1 >= len = {-# SCC "unstreamChunks/resize" #-} do
70 | i + 1 >= len = {-# SCC "unstreamChunks/resize" #-} do
69 let newLen = min (len `shiftL` 1) chunkSize
71 let newLen = min (len `shiftL` 1) chunkSize
70 marr' <- A.new newLen
72 marr' <- A.new newLen
@@ -73,7 +75,7 @@ unstreamChunks chunkSize (Stream next s0 len0)
73 | otherwise =
75 | otherwise =
74 {-# SCC "unstreamChunks/inner" #-}
76 {-# SCC "unstreamChunks/inner" #-}
75 case next s of
77 case next s of
76− Done -> return (marr,(s,i))
78+ Done -> return (marr, UC s i)
77 Skip s' -> inner marr len s' i
79 Skip s' -> inner marr len s' i
78 Yield x s' -> do d <- unsafeWrite marr i x
80 Yield x s' -> do d <- unsafeWrite marr i x
79 inner marr len s' (i+d)
81 inner marr len s' (i+d)
tests/benchmarks/.gitignore → benchmarks/.gitignorerenamed

The content is the same.

tests/benchmarks/Setup.hs → benchmarks/Setup.hsrenamed

The content is the same.

tests/benchmarks/cbits/time_iconv.c → benchmarks/cbits/time_iconv.crenamed

The content is the same.

tests/benchmarks/src/Data/Text/Benchmarks.hs → benchmarks/haskell/Benchmarks.hsrenamed+18−18
@@ -9,25 +9,25 @@ import Criterion.Main (Benchmark, defaultMain, bgroup)
9import System.FilePath ((</>))
9import System.FilePath ((</>))
10import System.IO (IOMode (WriteMode), openFile, hSetEncoding, utf8)
10import System.IO (IOMode (WriteMode), openFile, hSetEncoding, utf8)
11
11
12−import qualified Data.Text.Benchmarks.Builder as Builder
12+import qualified Benchmarks.Builder as Builder
13−import qualified Data.Text.Benchmarks.DecodeUtf8 as DecodeUtf8
13+import qualified Benchmarks.DecodeUtf8 as DecodeUtf8
14−import qualified Data.Text.Benchmarks.EncodeUtf8 as EncodeUtf8
14+import qualified Benchmarks.EncodeUtf8 as EncodeUtf8
15−import qualified Data.Text.Benchmarks.Equality as Equality
15+import qualified Benchmarks.Equality as Equality
16−import qualified Data.Text.Benchmarks.FileRead as FileRead
16+import qualified Benchmarks.FileRead as FileRead
17−import qualified Data.Text.Benchmarks.FoldLines as FoldLines
17+import qualified Benchmarks.FoldLines as FoldLines
18−import qualified Data.Text.Benchmarks.Pure as Pure
18+import qualified Benchmarks.Pure as Pure
19−import qualified Data.Text.Benchmarks.ReadNumbers as ReadNumbers
19+import qualified Benchmarks.ReadNumbers as ReadNumbers
20−import qualified Data.Text.Benchmarks.Replace as Replace
20+import qualified Benchmarks.Replace as Replace
21−import qualified Data.Text.Benchmarks.Search as Search
21+import qualified Benchmarks.Search as Search
22−import qualified Data.Text.Benchmarks.Stream as Stream
22+import qualified Benchmarks.Stream as Stream
23−import qualified Data.Text.Benchmarks.WordFrequencies as WordFrequencies
23+import qualified Benchmarks.WordFrequencies as WordFrequencies
24
24
25−import qualified Data.Text.Benchmarks.Programs.BigTable as Programs.BigTable
25+import qualified Benchmarks.Programs.BigTable as Programs.BigTable
26−import qualified Data.Text.Benchmarks.Programs.Cut as Programs.Cut
26+import qualified Benchmarks.Programs.Cut as Programs.Cut
27−import qualified Data.Text.Benchmarks.Programs.Fold as Programs.Fold
27+import qualified Benchmarks.Programs.Fold as Programs.Fold
28−import qualified Data.Text.Benchmarks.Programs.Sort as Programs.Sort
28+import qualified Benchmarks.Programs.Sort as Programs.Sort
29−import qualified Data.Text.Benchmarks.Programs.StripTags as Programs.StripTags
29+import qualified Benchmarks.Programs.StripTags as Programs.StripTags
30−import qualified Data.Text.Benchmarks.Programs.Throughput as Programs.Throughput
30+import qualified Benchmarks.Programs.Throughput as Programs.Throughput
31
31
32main :: IO ()
32main :: IO ()
33main = benchmarks >>= defaultMain
33main = benchmarks >>= defaultMain
tests/benchmarks/src/Data/Text/Benchmarks/Builder.hs → benchmarks/haskell/Benchmarks/Builder.hsrenamed+1−1
@@ -5,7 +5,7 @@
5-- * Concatenating many small strings using a builder
5-- * Concatenating many small strings using a builder
6--
6--
7{-# LANGUAGE OverloadedStrings #-}
7{-# LANGUAGE OverloadedStrings #-}
8−module Data.Text.Benchmarks.Builder
8+module Benchmarks.Builder
9 ( benchmark
9 ( benchmark
10 ) where
10 ) where
11
11
tests/benchmarks/src/Data/Text/Benchmarks/DecodeUtf8.hs → benchmarks/haskell/Benchmarks/DecodeUtf8.hsrenamed+1−1
@@ -14,7 +14,7 @@
14--
14--
15-- The latter are used for testing stream fusion.
15-- The latter are used for testing stream fusion.
16--
16--
17−module Data.Text.Benchmarks.DecodeUtf8
17+module Benchmarks.DecodeUtf8
18 ( benchmark
18 ( benchmark
19 ) where
19 ) where
20
20
tests/benchmarks/src/Data/Text/Benchmarks/EncodeUtf8.hs → benchmarks/haskell/Benchmarks/EncodeUtf8.hsrenamed+1−1
@@ -6,7 +6,7 @@
6--
6--
7-- * UTF-8 encoding it
7-- * UTF-8 encoding it
8--
8--
9−module Data.Text.Benchmarks.EncodeUtf8
9+module Benchmarks.EncodeUtf8
10 ( benchmark
10 ( benchmark
11 ) where
11 ) where
12
12
tests/benchmarks/src/Data/Text/Benchmarks/Equality.hs → benchmarks/haskell/Benchmarks/Equality.hsrenamed+1−1
@@ -5,7 +5,7 @@
5--
5--
6-- * Comparison of strings (Eq instance)
6-- * Comparison of strings (Eq instance)
7--
7--
8−module Data.Text.Benchmarks.Equality
8+module Benchmarks.Equality
9 ( benchmark
9 ( benchmark
10 ) where
10 ) where
11
11
tests/benchmarks/src/Data/Text/Benchmarks/FileRead.hs → benchmarks/haskell/Benchmarks/FileRead.hsrenamed+1−1
@@ -4,7 +4,7 @@
4--
4--
5-- * Reading a file from the disk
5-- * Reading a file from the disk
6--
6--
7−module Data.Text.Benchmarks.FileRead
7+module Benchmarks.FileRead
8 ( benchmark
8 ( benchmark
9 ) where
9 ) where
10
10
tests/benchmarks/src/Data/Text/Benchmarks/FoldLines.hs → benchmarks/haskell/Benchmarks/FoldLines.hsrenamed+1−1
@@ -6,7 +6,7 @@
6-- * Buffered, line-based IO
6-- * Buffered, line-based IO
7--
7--
8{-# LANGUAGE BangPatterns #-}
8{-# LANGUAGE BangPatterns #-}
9−module Data.Text.Benchmarks.FoldLines
9+module Benchmarks.FoldLines
10 ( benchmark
10 ( benchmark
11 ) where
11 ) where
12
12
tests/benchmarks/src/Data/Text/Benchmarks/Programs/BigTable.hs → benchmarks/haskell/Benchmarks/Programs/BigTable.hsrenamed+1−1
@@ -7,7 +7,7 @@
7-- * Writing to a handle
7-- * Writing to a handle
8--
8--
9{-# LANGUAGE OverloadedStrings #-}
9{-# LANGUAGE OverloadedStrings #-}
10−module Data.Text.Benchmarks.Programs.BigTable
10+module Benchmarks.Programs.BigTable
11 ( benchmark
11 ( benchmark
12 ) where
12 ) where
13
13
tests/benchmarks/src/Data/Text/Benchmarks/Programs/Cut.hs → benchmarks/haskell/Benchmarks/Programs/Cut.hsrenamed+1−1
@@ -12,7 +12,7 @@
12--
12--
13-- * Writing back to a handle
13-- * Writing back to a handle
14--
14--
15−module Data.Text.Benchmarks.Programs.Cut
15+module Benchmarks.Programs.Cut
16 ( benchmark
16 ( benchmark
17 ) where
17 ) where
18
18
tests/benchmarks/src/Data/Text/Benchmarks/Programs/Fold.hs → benchmarks/haskell/Benchmarks/Programs/Fold.hsrenamed+1−1
@@ -13,7 +13,7 @@
13-- * Writing back to a handle
13-- * Writing back to a handle
14--
14--
15{-# LANGUAGE OverloadedStrings #-}
15{-# LANGUAGE OverloadedStrings #-}
16−module Data.Text.Benchmarks.Programs.Fold
16+module Benchmarks.Programs.Fold
17 ( benchmark
17 ( benchmark
18 ) where
18 ) where
19
19
tests/benchmarks/src/Data/Text/Benchmarks/Programs/Sort.hs → benchmarks/haskell/Benchmarks/Programs/Sort.hsrenamed+1−1
@@ -13,7 +13,7 @@
13-- * Writing back to a handle
13-- * Writing back to a handle
14--
14--
15{-# LANGUAGE OverloadedStrings #-}
15{-# LANGUAGE OverloadedStrings #-}
16−module Data.Text.Benchmarks.Programs.Sort
16+module Benchmarks.Programs.Sort
17 ( benchmark
17 ( benchmark
18 ) where
18 ) where
19
19
tests/benchmarks/src/Data/Text/Benchmarks/Programs/StripTags.hs → benchmarks/haskell/Benchmarks/Programs/StripTags.hsrenamed+1−1
@@ -11,7 +11,7 @@
11-- * Writing back to a handle
11-- * Writing back to a handle
12--
12--
13{-# OPTIONS_GHC -fspec-constr-count=5 #-}
13{-# OPTIONS_GHC -fspec-constr-count=5 #-}
14−module Data.Text.Benchmarks.Programs.StripTags
14+module Benchmarks.Programs.StripTags
15 ( benchmark
15 ( benchmark
16 ) where
16 ) where
17
17
tests/benchmarks/src/Data/Text/Benchmarks/Programs/Throughput.hs → benchmarks/haskell/Benchmarks/Programs/Throughput.hsrenamed+1−1
@@ -14,7 +14,7 @@
14--
14--
15-- * Writing back to a handle
15-- * Writing back to a handle
16--
16--
17−module Data.Text.Benchmarks.Programs.Throughput
17+module Benchmarks.Programs.Throughput
18 ( benchmark
18 ( benchmark
19 ) where
19 ) where
20
20
tests/benchmarks/src/Data/Text/Benchmarks/Pure.hs → benchmarks/haskell/Benchmarks/Pure.hsrenamed+1−1
@@ -6,7 +6,7 @@
6--
6--
7{-# LANGUAGE BangPatterns, GADTs, MagicHash #-}
7{-# LANGUAGE BangPatterns, GADTs, MagicHash #-}
8{-# OPTIONS_GHC -fno-warn-orphans #-}
8{-# OPTIONS_GHC -fno-warn-orphans #-}
9−module Data.Text.Benchmarks.Pure
9+module Benchmarks.Pure
10 ( benchmark
10 ( benchmark
11 ) where
11 ) where
12
12
tests/benchmarks/src/Data/Text/Benchmarks/ReadNumbers.hs → benchmarks/haskell/Benchmarks/ReadNumbers.hsrenamed+1−1
@@ -16,7 +16,7 @@
16--
16--
17-- * Lexing/parsing of different numerical types
17-- * Lexing/parsing of different numerical types
18--
18--
19−module Data.Text.Benchmarks.ReadNumbers
19+module Benchmarks.ReadNumbers
20 ( benchmark
20 ( benchmark
21 ) where
21 ) where
22
22
tests/benchmarks/src/Data/Text/Benchmarks/Replace.hs → benchmarks/haskell/Benchmarks/Replace.hsrenamed+1−1
@@ -4,7 +4,7 @@
4--
4--
5-- * Search and replace of a pattern in a text
5-- * Search and replace of a pattern in a text
6--
6--
7−module Data.Text.Benchmarks.Replace
7+module Benchmarks.Replace
8 ( benchmark
8 ( benchmark
9 ) where
9 ) where
10
10
tests/benchmarks/src/Data/Text/Benchmarks/Search.hs → benchmarks/haskell/Benchmarks/Search.hsrenamed+1−1
@@ -4,7 +4,7 @@
4--
4--
5-- * Searching all occurences of a pattern using library routines
5-- * Searching all occurences of a pattern using library routines
6--
6--
7−module Data.Text.Benchmarks.Search
7+module Benchmarks.Search
8 ( benchmark
8 ( benchmark
9 ) where
9 ) where
10
10
tests/benchmarks/src/Data/Text/Benchmarks/Stream.hs → benchmarks/haskell/Benchmarks/Stream.hsrenamed+1−1
@@ -7,7 +7,7 @@
7--
7--
8{-# LANGUAGE BangPatterns #-}
8{-# LANGUAGE BangPatterns #-}
9{-# OPTIONS_GHC -fno-warn-orphans #-}
9{-# OPTIONS_GHC -fno-warn-orphans #-}
10−module Data.Text.Benchmarks.Stream
10+module Benchmarks.Stream
11 ( benchmark
11 ( benchmark
12 ) where
12 ) where
13
13
tests/benchmarks/src/Data/Text/Benchmarks/WordFrequencies.hs → benchmarks/haskell/Benchmarks/WordFrequencies.hsrenamed+1−1
@@ -8,7 +8,7 @@
8--
8--
9-- * Comparing: Eq/Ord instances
9-- * Comparing: Eq/Ord instances
10--
10--
11−module Data.Text.Benchmarks.WordFrequencies
11+module Benchmarks.WordFrequencies
12 ( benchmark
12 ( benchmark
13 ) where
13 ) where
14
14
tests/benchmarks/python/.gitignore → benchmarks/python/.gitignorerenamed

The content is the same.

tests/benchmarks/python/cut.py → benchmarks/python/cut.pyrenamed

The content is the same.

tests/benchmarks/python/sort.py → benchmarks/python/sort.pyrenamed

The content is the same.

tests/benchmarks/python/strip_tags.py → benchmarks/python/strip_tags.pyrenamed

The content is the same.

tests/benchmarks/python/utils.py → benchmarks/python/utils.pyrenamed

The content is the same.

tests/benchmarks/ruby/cut.rb → benchmarks/ruby/cut.rbrenamed

The content is the same.

tests/benchmarks/ruby/fold.rb → benchmarks/ruby/fold.rbrenamed

The content is the same.

tests/benchmarks/ruby/sort.rb → benchmarks/ruby/sort.rbrenamed

The content is the same.

tests/benchmarks/ruby/strip_tags.rb → benchmarks/ruby/strip_tags.rbrenamed

The content is the same.

tests/benchmarks/ruby/utils.rb → benchmarks/ruby/utils.rbrenamed

The content is the same.

benchmarks/text-benchmarks.cabalnew file+37
@@ -0,0 +1,37 @@
1+name: text-benchmarks
2+version: 0.0.0.0
3+synopsis: Benchmarks for the text package
4+description: Benchmarks for the text package
5+homepage: https://bitbucket.org/bos/text
6+license: BSD3
7+license-file: ../LICENSE
8+author: Jasper Van der Jeugt <jaspervdj@gmail.com>,
9+ Bryan O'Sullivan <bos@serpentine.com>,
10+ Tom Harper <rtomharper@googlemail.com>,
11+ Duncan Coutts <duncan@haskell.org>
12+maintainer: jaspervdj@gmail.com
13+category: Text
14+build-type: Simple
15+
16+cabal-version: >=1.2
17+
18+executable text-benchmarks
19+ hs-source-dirs: haskell ..
20+ c-sources: ../cbits/cbits.c
21+ cbits/time_iconv.c
22+ main-is: Benchmarks.hs
23+ ghc-options: -Wall -O2
24+ cpp-options: -DHAVE_DEEPSEQ
25+ build-depends: base == 4.*,
26+ binary,
27+ blaze-builder,
28+ bytestring,
29+ bytestring-lexing,
30+ containers,
31+ criterion >= 0.6.0.1,
32+ deepseq,
33+ directory,
34+ filepath,
35+ ghc-prim,
36+ stringsearch,
37+ utf8-string
tests/benchmarks/text-benchmarks.cabaldeleted−36
@@ -1,36 +0,0 @@
1−name: text-benchmarks
2−version: 0.0.0.0
3−synopsis: Benchmarks for the text package
4−description: Benchmarks for the text package
5−homepage: https://bitbucket.org/bos/text
6−license: BSD3
7−license-file: ../../LICENSE
8−author: Jasper Van der Jeugt <jaspervdj@gmail.com>,
9− Bryan O'Sullivan <bos@serpentine.com>,
10− Tom Harper <rtomharper@googlemail.com>,
11− Duncan Coutts <duncan@haskell.org>
12−maintainer: jaspervdj@gmail.com
13−category: Text
14−build-type: Simple
15−
16−cabal-version: >=1.2
17−
18−executable text-benchmarks
19− hs-source-dirs: src ../..
20− c-sources: ../../cbits/cbits.c
21− cbits/time_iconv.c
22− main-is: Data/Text/Benchmarks.hs
23− ghc-options: -Wall -O2
24− cpp-options: -DHAVE_DEEPSEQ
25− build-depends: base >= 4 && < 5,
26− criterion >= 0.5 && < 0.7,
27− bytestring >= 0.9,
28− deepseq >= 1.1 && < 1.2,
29− filepath >= 1.1 && < 1.3,
30− directory >= 1.1 && < 1.2,
31− containers >= 0.3 && < 0.5,
32− binary >= 0.5 && < 0.6,
33− utf8-string >= 0.3 && < 0.4,
34− blaze-builder >= 0.3 && < 0.4,
35− bytestring-lexing >= 0.2 && < 0.3,
36− stringsearch >= 0.3 && < 0.4
text.cabal+8−8
@@ -49,18 +49,18 @@ category: Data, Text
49build-type: Simple
49build-type: Simple
50cabal-version: >= 1.8
50cabal-version: >= 1.8
51extra-source-files:
51extra-source-files:
52− README.markdown
53 -- scripts/CaseFolding.txt
52 -- scripts/CaseFolding.txt
54 -- scripts/SpecialCasing.txt
53 -- scripts/SpecialCasing.txt
54+ README.markdown
55+ benchmarks/Setup.hs
56+ benchmarks/cbits/*.c
57+ benchmarks/python/*.py
58+ benchmarks/ruby/*.rb
59+ benchmarks/src/Data/Text/*.hs
60+ benchmarks/src/Data/Text/Benchmarks/*.hs
61+ benchmarks/text-benchmarks.cabal
55 scripts/*.hs
62 scripts/*.hs
56 tests/README.markdown
63 tests/README.markdown
57− tests/benchmarks/Setup.hs
58− tests/benchmarks/cbits/*.c
59− tests/benchmarks/python/*.py
60− tests/benchmarks/ruby/*.rb
61− tests/benchmarks/src/Data/Text/*.hs
62− tests/benchmarks/src/Data/Text/Benchmarks/*.hs
63− tests/benchmarks/text-benchmarks.cabal
64 tests/tests/.ghci
64 tests/tests/.ghci
65 tests/tests/Makefile
65 tests/tests/Makefile
66 tests/tests/scripts/*.sh
66 tests/tests/scripts/*.sh