on master help sign in
Array.Foreign -> Array.Unboxed in tests and benchmarks & intenals

Co-authored-by: Ranjeet <ranjeet@composewell.com>

commit18a226b9f0cbdeb8022e77ab958026376d9b2f9b authorRanjeet Kumar Ranjan <ranjeetr@composewell.com> dateTue 9 Aug 2022, 13:08 (4 years ago) parent08acfe2
12 files changed+31−31
.github/workflows/regression-check.yml+1−1 benchmark/Streamly/Benchmark/Data/Array/Foreign.hs → benchmark/Streamly/Benchmark/Data/Array/Unboxed.hs+1−1 benchmark/Streamly/Benchmark/Data/Array/Foreign/Mut.hs → benchmark/Streamly/Benchmark/Data/Array/Unboxed/Mut.hs+2−2 benchmark/bench-runner/Main.hs+2−2 benchmark/streamly-benchmarks.cabal+4−4 core/src/Streamly/Internal/Data/Array/Unboxed.hs+1−1 hie.yaml+2−2 streamly.cabal+3−3 targets/Targets.hs+2−2 test/Streamly/Test/Data/Array/Foreign.hs → test/Streamly/Test/Data/Array/Unboxed.hs+9−9 test/streamly-tests.cabal+3−3 test/test-runner/Main.hs+1−1
.github/workflows/regression-check.yml+1−1
@@ -19,7 +19,7 @@ jobs:
1919 env:
2020 CI_BENCHMARKS_WITH_CUTOFF: >-
2121 Data.Array
22− Data.Array.Foreign
22+ Data.Array.Unboxed
2323 Data.Fold
2424 Data.Parser
2525 Data.Parser.ParserD
benchmark/Streamly/Benchmark/Data/Array/Foreign.hs → benchmark/Streamly/Benchmark/Data/Array/Unboxed.hsrenamed+1−1
@@ -114,7 +114,7 @@ o_n_heap_serial value =
114114 ]
115115
116116moduleName :: String
117−moduleName = "Data.Array.Foreign"
117+moduleName = "Data.Array.Unboxed"
118118
119119defStreamSize :: Int
120120defStreamSize = defaultStreamSize
benchmark/Streamly/Benchmark/Data/Array/Foreign/Mut.hs → benchmark/Streamly/Benchmark/Data/Array/Unboxed/Mut.hsrenamed+2−2
@@ -1,5 +1,5 @@
11-- |
2−-- Module : Streamly.Benchmark.Data.Array.Foreign.Mut
2+-- Module : Streamly.Benchmark.Data.Array.Unboxed.Mut
33-- Copyright : (c) 2021 Composewell Technologies
44-- License : BSD-3-Clause
55-- Maintainer : streamly@composewell.com
@@ -264,7 +264,7 @@ o_1_space_serial_marray value ~(array, indices) =
264264-------------------------------------------------------------------------------
265265
266266moduleName :: String
267−moduleName = "Data.Array.Foreign.Mut"
267+moduleName = "Data.Array.Unboxed.Mut"
268268
269269main :: IO ()
270270main = do
benchmark/bench-runner/Main.hs+2−2
@@ -76,9 +76,9 @@ rtsOpts exeName benchName0 = unwords [general, exeSpecific, benchSpecific]
7676 | "Data.Array" `isPrefixOf` benchName
7777 && "/o-1-space.generation.show" `isSuffixOf` benchName = "-M32M"
7878 | "Data.Array/o-1-space.transformationX4.map" == benchName = "-M32M"
79− | "Data.Array.Foreign/o-1-space.elimination.foldable.foldl"
79+ | "Data.Array.Unboxed/o-1-space.elimination.foldable.foldl"
8080 `isPrefixOf` benchName = "-K8M"
81− | "Data.Array.Foreign/o-1-space.elimination.foldable.sum" == benchName =
81+ | "Data.Array.Unboxed/o-1-space.elimination.foldable.sum" == benchName =
8282 "-K8M"
8383 | "Unicode.Char/o-1-space." `isPrefixOf` benchName = "-M32M"
8484 | otherwise = ""
benchmark/streamly-benchmarks.cabal+4−4
@@ -512,10 +512,10 @@ benchmark Data.SmallArray
512512 else
513513 buildable: True
514514
515−benchmark Data.Array.Foreign
515+benchmark Data.Array.Unboxed
516516 import: bench-options
517517 type: exitcode-stdio-1.0
518− main-is: Streamly/Benchmark/Data/Array/Foreign.hs
518+ main-is: Streamly/Benchmark/Data/Array/Unboxed.hs
519519 if flag(bench-core)
520520 buildable: False
521521 else
@@ -523,10 +523,10 @@ benchmark Data.Array.Foreign
523523 if flag(limit-build-mem)
524524 ghc-options: +RTS -M1500M -RTS
525525
526−benchmark Data.Array.Foreign.Mut
526+benchmark Data.Array.Unboxed.Mut
527527 import: bench-options
528528 type: exitcode-stdio-1.0
529− main-is: Streamly/Benchmark/Data/Array/Foreign/Mut.hs
529+ main-is: Streamly/Benchmark/Data/Array/Unboxed/Mut.hs
530530 if flag(limit-build-mem)
531531 ghc-options: +RTS -M1500M -RTS
532532 if flag(bench-core)
core/src/Streamly/Internal/Data/Array/Unboxed.hs+1−1
@@ -1,5 +1,5 @@
11-- |
2−-- Module : Streamly.Internal.Data.Array.Foreign
2+-- Module : Streamly.Internal.Data.Array.Unboxed
33-- Copyright : (c) 2019 Composewell Technologies
44--
55-- License : BSD3
hie.yaml+2−2
@@ -72,8 +72,8 @@ cradle:
7272 cabal:
7373 - path: "./test/Streamly/Test/Data/Array.hs"
7474 component: "test:Data.Array"
75− - path: "./test/Streamly/Test/Data/Array/Foreign.hs"
76− component: "test:Data.Array.Foreign"
75+ - path: "./test/Streamly/Test/Data/Array/Unboxed.hs"
76+ component: "test:Data.Array.Unboxed"
7777 - path: "./test/Streamly/Test/Data/Array/Stream/Foreign.hs"
7878 component: "test:Data.Array.Stream.Foreign"
7979 - path: "./test/Streamly/Test/Data/Fold.hs"
streamly.cabal+3−3
@@ -55,9 +55,9 @@ extra-source-files:
5555 benchmark/Streamly/Benchmark/Data/Array/Common.hs
5656 benchmark/Streamly/Benchmark/Data/Array/CommonImports.hs
5757 benchmark/Streamly/Benchmark/Data/Array/SmallArray.hs
58− benchmark/Streamly/Benchmark/Data/Array/Foreign.hs
58+ benchmark/Streamly/Benchmark/Data/Array/Unboxed.hs
5959 benchmark/Streamly/Benchmark/Data/Ring/Unboxed.hs
60− benchmark/Streamly/Benchmark/Data/Array/Foreign/Mut.hs
60+ benchmark/Streamly/Benchmark/Data/Array/Unboxed/Mut.hs
6161 benchmark/Streamly/Benchmark/Data/Array/Stream/Foreign.hs
6262 benchmark/Streamly/Benchmark/Data/Fold/Window.hs
6363 benchmark/Streamly/Benchmark/Data/Parser/*.hs
@@ -91,7 +91,7 @@ extra-source-files:
9191 test/Streamly/Test/Data/*.hs
9292 test/Streamly/Test/Data/Array/CommonImports.hs
9393 test/Streamly/Test/Data/Array/Common.hs
94− test/Streamly/Test/Data/Array/Foreign.hs
94+ test/Streamly/Test/Data/Array/Unboxed.hs
9595 test/Streamly/Test/Data/Ring/Unboxed.hs
9696 test/Streamly/Test/Data/Array/Stream/Foreign.hs
9797 test/Streamly/Test/Data/Parser/ParserD.hs
targets/Targets.hs+2−2
@@ -94,13 +94,13 @@ targets =
9494 , "array_cmp"
9595 ]
9696 )
97− , ("Data.Array.Foreign",
97+ , ("Data.Array.Unboxed",
9898 [ "array_grp"
9999 , "array_cmp"
100100 , "pinned_array_cmp"
101101 ]
102102 )
103− , ("Data.Array.Foreign.Mut",
103+ , ("Data.Array.Unboxed.Mut",
104104 [ "array_grp"
105105 , "array_cmp"
106106 , "noTest"
test/Streamly/Test/Data/Array/Foreign.hs → test/Streamly/Test/Data/Array/Unboxed.hsrenamed+9−9
@@ -1,12 +1,12 @@
11-- |
2−-- Module : Streamly.Test.Data.Array.Foreign
2+-- Module : Streamly.Test.Data.Array.Unboxed
33-- Copyright : (c) 2019 Composewell technologies
44-- License : BSD-3-Clause
55-- Maintainer : streamly@composewell.com
66-- Stability : experimental
77-- Portability : GHC
88
9−module Streamly.Test.Data.Array.Foreign (main) where
9+module Streamly.Test.Data.Array.Unboxed (main) where
1010
1111#include "Streamly/Test/Data/Array/CommonImports.hs"
1212
@@ -27,7 +27,7 @@ import qualified Streamly.Internal.Data.Array.Stream.Foreign as AS
2727type Array = A.Array
2828
2929moduleName :: String
30−moduleName = "Data.Array.Foreign"
30+moduleName = "Data.Array.Unboxed"
3131
3232#include "Streamly/Test/Data/Array/Common.hs"
3333
@@ -43,7 +43,7 @@ testFromList =
4343 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
4444 monadicIO $ do
4545 let arr = A.fromList list
46− xs <- run $ S.toList $ (S.unfold A.read) arr
46+ xs <- run $ S.toList $ S.unfold A.read arr
4747 assert (xs == list)
4848
4949testLengthFromStream :: Property
@@ -133,7 +133,7 @@ concatArrayW8 =
133133
134134unsafeSlice :: Int -> Int -> [Int] -> Bool
135135unsafeSlice i n list =
136− let lst = take n $ drop i $ list
136+ let lst = take n $ drop i list
137137 arr = A.toList $ A.getSliceUnsafe i n $ A.fromList list
138138 in arr == lst
139139
@@ -190,7 +190,7 @@ testByteLengthWithMA _ = do
190190 let arrW8 = MA.castUnsafe arrA :: MA.Array Word8
191191 MA.byteLength arrA `shouldBe` MA.length arrW8
192192
193−testBreakOn :: [Word8] -> Word8 -> [Word8] -> (Maybe [Word8]) -> IO ()
193+testBreakOn :: [Word8] -> Word8 -> [Word8] -> Maybe [Word8] -> IO ()
194194testBreakOn inp sep bef aft = do
195195 (bef_, aft_) <- A.breakOn sep (A.fromList inp)
196196 bef_ `shouldBe` A.fromList bef
@@ -207,7 +207,7 @@ testFromToList inp = A.toList (A.fromList inp) `shouldBe` inp
207207testUnsafeIndxedFromList :: [Char] -> IO ()
208208testUnsafeIndxedFromList inp =
209209 let arr = A.fromList inp
210− in fmap (flip A.unsafeIndex arr) [0 .. (length inp - 1)] `shouldBe` inp
210+ in fmap (`A.unsafeIndex` arr) [0 .. (length inp - 1)] `shouldBe` inp
211211
212212testAsPtrUnsafeMA :: IO ()
213213testAsPtrUnsafeMA = do
@@ -257,7 +257,7 @@ main =
257257 prop "fromList" testFromList
258258 prop "foldMany with writeNUnsafe concats to original"
259259 (foldManyWith (\n -> Fold.take n (A.writeNUnsafe n)))
260− prop "AS.concat . (A.fromList . (:[]) <$>) === id" $ concatArrayW8
260+ prop "AS.concat . (A.fromList . (:[]) <$>) === id" concatArrayW8
261261 describe "unsafeSlice" $ do
262262 it "partial" $ unsafeSlice 2 4 [1..10]
263263 it "none" $ unsafeSlice 10 0 [1..10]
@@ -267,7 +267,7 @@ main =
267267 it "middle" (unsafeWriteIndex [1..10] 5 0 `shouldReturn` True)
268268 it "last" (unsafeWriteIndex [1..10] 9 0 `shouldReturn` True)
269269 describe "Fold" $ do
270− prop "writeLastN : 0 <= n <= len" $ testLastN
270+ prop "writeLastN : 0 <= n <= len" testLastN
271271 describe "writeLastN boundary conditions" $ do
272272 it "writeLastN -1" (testLastN_LN 10 (-1) `shouldReturn` True)
273273 it "writeLastN 0" (testLastN_LN 10 0 `shouldReturn` True)
test/streamly-tests.cabal+3−3
@@ -223,11 +223,11 @@ test-suite Data.Array
223223 main-is: Streamly/Test/Data/Array.hs
224224 ghc-options: -main-is Streamly.Test.Data.Array.main
225225
226−test-suite Data.Array.Foreign
226+test-suite Data.Array.Unboxed
227227 import: test-options
228228 type: exitcode-stdio-1.0
229− main-is: Streamly/Test/Data/Array/Foreign.hs
230− ghc-options: -main-is Streamly.Test.Data.Array.Foreign.main
229+ main-is: Streamly/Test/Data/Array/Unboxed.hs
230+ ghc-options: -main-is Streamly.Test.Data.Array.Unboxed.main
231231
232232test-suite Data.Ring.Unboxed
233233 import: test-options
test/test-runner/Main.hs+1−1
@@ -21,7 +21,7 @@ rtsOpts relaxMem exeName target =
2121 targetSpecific =
2222 case target of
2323 -- XXX Data.Array.* heap requirement increased for GHC-8.10
24− "Data.Array.Foreign" -> "-M128M"
24+ "Data.Array.Unboxed" -> "-M128M"
2525 "Prelude.Rate" -> "-M512M"
2626 -- For -O0 case writeChunks test fails, maybe we should have a
2727 -- separate flag for O0 case?