Array.Foreign -> Array.Unboxed in tests and benchmarks & intenals

Co-authored-by: Ranjeet <ranjeet@composewell.com>
This commit is contained in:
Ranjeet Kumar Ranjan 2022-08-09 13:08:10 +05:30 committed by Harendra Kumar
parent 08acfe2e59
commit 18a226b9f0
12 changed files with 31 additions and 31 deletions

View File

@ -19,7 +19,7 @@ jobs:
env:
CI_BENCHMARKS_WITH_CUTOFF: >-
Data.Array
Data.Array.Foreign
Data.Array.Unboxed
Data.Fold
Data.Parser
Data.Parser.ParserD

View File

@ -114,7 +114,7 @@ o_n_heap_serial value =
]
moduleName :: String
moduleName = "Data.Array.Foreign"
moduleName = "Data.Array.Unboxed"
defStreamSize :: Int
defStreamSize = defaultStreamSize

View File

@ -1,5 +1,5 @@
-- |
-- Module : Streamly.Benchmark.Data.Array.Foreign.Mut
-- Module : Streamly.Benchmark.Data.Array.Unboxed.Mut
-- Copyright : (c) 2021 Composewell Technologies
-- License : BSD-3-Clause
-- Maintainer : streamly@composewell.com
@ -264,7 +264,7 @@ o_1_space_serial_marray value ~(array, indices) =
-------------------------------------------------------------------------------
moduleName :: String
moduleName = "Data.Array.Foreign.Mut"
moduleName = "Data.Array.Unboxed.Mut"
main :: IO ()
main = do

View File

@ -76,9 +76,9 @@ rtsOpts exeName benchName0 = unwords [general, exeSpecific, benchSpecific]
| "Data.Array" `isPrefixOf` benchName
&& "/o-1-space.generation.show" `isSuffixOf` benchName = "-M32M"
| "Data.Array/o-1-space.transformationX4.map" == benchName = "-M32M"
| "Data.Array.Foreign/o-1-space.elimination.foldable.foldl"
| "Data.Array.Unboxed/o-1-space.elimination.foldable.foldl"
`isPrefixOf` benchName = "-K8M"
| "Data.Array.Foreign/o-1-space.elimination.foldable.sum" == benchName =
| "Data.Array.Unboxed/o-1-space.elimination.foldable.sum" == benchName =
"-K8M"
| "Unicode.Char/o-1-space." `isPrefixOf` benchName = "-M32M"
| otherwise = ""

View File

@ -512,10 +512,10 @@ benchmark Data.SmallArray
else
buildable: True
benchmark Data.Array.Foreign
benchmark Data.Array.Unboxed
import: bench-options
type: exitcode-stdio-1.0
main-is: Streamly/Benchmark/Data/Array/Foreign.hs
main-is: Streamly/Benchmark/Data/Array/Unboxed.hs
if flag(bench-core)
buildable: False
else
@ -523,10 +523,10 @@ benchmark Data.Array.Foreign
if flag(limit-build-mem)
ghc-options: +RTS -M1500M -RTS
benchmark Data.Array.Foreign.Mut
benchmark Data.Array.Unboxed.Mut
import: bench-options
type: exitcode-stdio-1.0
main-is: Streamly/Benchmark/Data/Array/Foreign/Mut.hs
main-is: Streamly/Benchmark/Data/Array/Unboxed/Mut.hs
if flag(limit-build-mem)
ghc-options: +RTS -M1500M -RTS
if flag(bench-core)

View File

@ -1,5 +1,5 @@
-- |
-- Module : Streamly.Internal.Data.Array.Foreign
-- Module : Streamly.Internal.Data.Array.Unboxed
-- Copyright : (c) 2019 Composewell Technologies
--
-- License : BSD3

View File

@ -72,8 +72,8 @@ cradle:
cabal:
- path: "./test/Streamly/Test/Data/Array.hs"
component: "test:Data.Array"
- path: "./test/Streamly/Test/Data/Array/Foreign.hs"
component: "test:Data.Array.Foreign"
- path: "./test/Streamly/Test/Data/Array/Unboxed.hs"
component: "test:Data.Array.Unboxed"
- path: "./test/Streamly/Test/Data/Array/Stream/Foreign.hs"
component: "test:Data.Array.Stream.Foreign"
- path: "./test/Streamly/Test/Data/Fold.hs"

View File

@ -55,9 +55,9 @@ extra-source-files:
benchmark/Streamly/Benchmark/Data/Array/Common.hs
benchmark/Streamly/Benchmark/Data/Array/CommonImports.hs
benchmark/Streamly/Benchmark/Data/Array/SmallArray.hs
benchmark/Streamly/Benchmark/Data/Array/Foreign.hs
benchmark/Streamly/Benchmark/Data/Array/Unboxed.hs
benchmark/Streamly/Benchmark/Data/Ring/Unboxed.hs
benchmark/Streamly/Benchmark/Data/Array/Foreign/Mut.hs
benchmark/Streamly/Benchmark/Data/Array/Unboxed/Mut.hs
benchmark/Streamly/Benchmark/Data/Array/Stream/Foreign.hs
benchmark/Streamly/Benchmark/Data/Fold/Window.hs
benchmark/Streamly/Benchmark/Data/Parser/*.hs
@ -91,7 +91,7 @@ extra-source-files:
test/Streamly/Test/Data/*.hs
test/Streamly/Test/Data/Array/CommonImports.hs
test/Streamly/Test/Data/Array/Common.hs
test/Streamly/Test/Data/Array/Foreign.hs
test/Streamly/Test/Data/Array/Unboxed.hs
test/Streamly/Test/Data/Ring/Unboxed.hs
test/Streamly/Test/Data/Array/Stream/Foreign.hs
test/Streamly/Test/Data/Parser/ParserD.hs

View File

@ -94,13 +94,13 @@ targets =
, "array_cmp"
]
)
, ("Data.Array.Foreign",
, ("Data.Array.Unboxed",
[ "array_grp"
, "array_cmp"
, "pinned_array_cmp"
]
)
, ("Data.Array.Foreign.Mut",
, ("Data.Array.Unboxed.Mut",
[ "array_grp"
, "array_cmp"
, "noTest"

View File

@ -1,12 +1,12 @@
-- |
-- Module : Streamly.Test.Data.Array.Foreign
-- Module : Streamly.Test.Data.Array.Unboxed
-- Copyright : (c) 2019 Composewell technologies
-- License : BSD-3-Clause
-- Maintainer : streamly@composewell.com
-- Stability : experimental
-- Portability : GHC
module Streamly.Test.Data.Array.Foreign (main) where
module Streamly.Test.Data.Array.Unboxed (main) where
#include "Streamly/Test/Data/Array/CommonImports.hs"
@ -27,7 +27,7 @@ import qualified Streamly.Internal.Data.Array.Stream.Foreign as AS
type Array = A.Array
moduleName :: String
moduleName = "Data.Array.Foreign"
moduleName = "Data.Array.Unboxed"
#include "Streamly/Test/Data/Array/Common.hs"
@ -43,7 +43,7 @@ testFromList =
forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
monadicIO $ do
let arr = A.fromList list
xs <- run $ S.toList $ (S.unfold A.read) arr
xs <- run $ S.toList $ S.unfold A.read arr
assert (xs == list)
testLengthFromStream :: Property
@ -133,7 +133,7 @@ concatArrayW8 =
unsafeSlice :: Int -> Int -> [Int] -> Bool
unsafeSlice i n list =
let lst = take n $ drop i $ list
let lst = take n $ drop i list
arr = A.toList $ A.getSliceUnsafe i n $ A.fromList list
in arr == lst
@ -190,7 +190,7 @@ testByteLengthWithMA _ = do
let arrW8 = MA.castUnsafe arrA :: MA.Array Word8
MA.byteLength arrA `shouldBe` MA.length arrW8
testBreakOn :: [Word8] -> Word8 -> [Word8] -> (Maybe [Word8]) -> IO ()
testBreakOn :: [Word8] -> Word8 -> [Word8] -> Maybe [Word8] -> IO ()
testBreakOn inp sep bef aft = do
(bef_, aft_) <- A.breakOn sep (A.fromList inp)
bef_ `shouldBe` A.fromList bef
@ -207,7 +207,7 @@ testFromToList inp = A.toList (A.fromList inp) `shouldBe` inp
testUnsafeIndxedFromList :: [Char] -> IO ()
testUnsafeIndxedFromList inp =
let arr = A.fromList inp
in fmap (flip A.unsafeIndex arr) [0 .. (length inp - 1)] `shouldBe` inp
in fmap (`A.unsafeIndex` arr) [0 .. (length inp - 1)] `shouldBe` inp
testAsPtrUnsafeMA :: IO ()
testAsPtrUnsafeMA = do
@ -257,7 +257,7 @@ main =
prop "fromList" testFromList
prop "foldMany with writeNUnsafe concats to original"
(foldManyWith (\n -> Fold.take n (A.writeNUnsafe n)))
prop "AS.concat . (A.fromList . (:[]) <$>) === id" $ concatArrayW8
prop "AS.concat . (A.fromList . (:[]) <$>) === id" concatArrayW8
describe "unsafeSlice" $ do
it "partial" $ unsafeSlice 2 4 [1..10]
it "none" $ unsafeSlice 10 0 [1..10]
@ -267,7 +267,7 @@ main =
it "middle" (unsafeWriteIndex [1..10] 5 0 `shouldReturn` True)
it "last" (unsafeWriteIndex [1..10] 9 0 `shouldReturn` True)
describe "Fold" $ do
prop "writeLastN : 0 <= n <= len" $ testLastN
prop "writeLastN : 0 <= n <= len" testLastN
describe "writeLastN boundary conditions" $ do
it "writeLastN -1" (testLastN_LN 10 (-1) `shouldReturn` True)
it "writeLastN 0" (testLastN_LN 10 0 `shouldReturn` True)

View File

@ -223,11 +223,11 @@ test-suite Data.Array
main-is: Streamly/Test/Data/Array.hs
ghc-options: -main-is Streamly.Test.Data.Array.main
test-suite Data.Array.Foreign
test-suite Data.Array.Unboxed
import: test-options
type: exitcode-stdio-1.0
main-is: Streamly/Test/Data/Array/Foreign.hs
ghc-options: -main-is Streamly.Test.Data.Array.Foreign.main
main-is: Streamly/Test/Data/Array/Unboxed.hs
ghc-options: -main-is Streamly.Test.Data.Array.Unboxed.main
test-suite Data.Ring.Unboxed
import: test-options

View File

@ -21,7 +21,7 @@ rtsOpts relaxMem exeName target =
targetSpecific =
case target of
-- XXX Data.Array.* heap requirement increased for GHC-8.10
"Data.Array.Foreign" -> "-M128M"
"Data.Array.Unboxed" -> "-M128M"
"Prelude.Rate" -> "-M512M"
-- For -O0 case writeChunks test fails, maybe we should have a
-- separate flag for O0 case?