@@ -12,7 +12,8 @@
13-- MEMORY_ARRAY
13-- MEMORY_ARRAY
14-- DATA_ARRAY
14-- DATA_ARRAY
15−-- DATA_PRIM_ARRAY
15+-- DATA_ARRAY_PRIM
16+-- DATA_ARRAY_PRIM_PINNED
16-- DATA_SMALLARRAY
17-- DATA_SMALLARRAY
18module Streamly.Benchmark.Data.ArrayOps where
19module Streamly.Benchmark.Data.ArrayOps where
@@ -23,7 +24,7 @@ import Prelude (Bool, Int, Maybe(..), ($), (+), (.), (==), (>), undefined)
23import qualified Prelude as P
24import qualified Prelude as P
24import qualified Streamly.Prelude as S
25import qualified Streamly.Prelude as S
26−#ifndef DATA_PRIM_ARRAY
27+#if !defined(DATA_ARRAY_PRIM) && !defined(DATA_ARRAY_PRIM_PINNED)
27#ifdef DEVBUILD
28#ifdef DEVBUILD
28import qualified Data.Foldable as F
29import qualified Data.Foldable as F
@@ -37,10 +38,13 @@ import qualified GHC.Exts as GHC
37import qualified Streamly.Data.Array.Storable.Foreign as A
38import qualified Streamly.Data.Array.Storable.Foreign as A
38import qualified Streamly.Internal.Data.Array.Storable.Foreign as A
39import qualified Streamly.Internal.Data.Array.Storable.Foreign as A
39type Stream = A.Array
40type Stream = A.Array
40−#elif defined(DATA_PRIM_ARRAY)
41+#elif defined(DATA_ARRAY_PRIM)
41−import qualified Streamly.Internal.Data.Prim.Array as A
42+import qualified Streamly.Internal.Data.Array.Prim as A
44+#elif defined(DATA_ARRAY_PRIM_PINNED)
45+import qualified Streamly.Internal.Data.Array.Prim.Pinned as A
42−type Stream = A.PrimArray
46+type Stream = A.Array
43−#else
47+#elif defined(DATA_ARRAY)
44import qualified Streamly.Internal.Data.Array as A
48import qualified Streamly.Internal.Data.Array as A
45type Stream = A.Array
49type Stream = A.Array
@@ -57,7 +61,8 @@ type Stream = A.Array
57-- CPP Common to:
61-- CPP Common to:
58-- MEMORY_ARRAY
62-- MEMORY_ARRAY
59-- DATA_ARRAY
63-- DATA_ARRAY
60−-- DATA_PRIM_ARRAY
64+-- DATA_ARRAY_PRIM
65+-- DATA_ARRAY_PRIM_PINNED
61-- DATA_SMALLARRAY
66-- DATA_SMALLARRAY
62-------------------------------------------------------------------------------
67-------------------------------------------------------------------------------
@@ -92,7 +97,8 @@ sourceIntFromToFromList value n = P.return $ A.fromListN value $ [n..n + value]
92-- CPP Common to:
97-- CPP Common to:
93-- MEMORY_ARRAY
98-- MEMORY_ARRAY
94-- DATA_ARRAY
99-- DATA_ARRAY
95−-- DATA_PRIM_ARRAY
100+-- DATA_ARRAY_PRIM
101+-- DATA_ARRAY_PRIM_PINNED
96-------------------------------------------------------------------------------
102-------------------------------------------------------------------------------
@@ -126,7 +132,8 @@ sourceIsString value n = GHC.fromString (P.replicate (n + value) 'a')
126-- CPP Common to:
132-- CPP Common to:
127-- MEMORY_ARRAY
133-- MEMORY_ARRAY
128-- DATA_ARRAY
134-- DATA_ARRAY
129−-- DATA_PRIM_ARRAY
135+-- DATA_ARRAY_PRIM
136+-- DATA_ARRAY_PRIM_PINNED
130-- DATA_SMALLARRAY
137-- DATA_SMALLARRAY
131-------------------------------------------------------------------------------
138-------------------------------------------------------------------------------
@@ -193,7 +200,7 @@ pureFoldl' = S.foldl' (+) 0 . S.unfold A.read
193-------------------------------------------------------------------------------
200-------------------------------------------------------------------------------
196−#ifndef DATA_PRIM_ARRAY
203+#if !defined(DATA_ARRAY_PRIM) && !defined(DATA_ARRAY_PRIM_PINNED)
197{-# INLINE readInstance #-}
204{-# INLINE readInstance #-}
198readInstance :: P.String -> Stream Int
205readInstance :: P.String -> Stream Int
199readInstance str =
206readInstance str =
@@ -221,7 +228,8 @@ foldableSum = P.sum
221-- CPP Common to:
228-- CPP Common to:
222-- MEMORY_ARRAY
229-- MEMORY_ARRAY
223-- DATA_ARRAY
230-- DATA_ARRAY
224−-- DATA_PRIM_ARRAY
231+-- DATA_ARRAY_PRIM
232+-- DATA_ARRAY_PRIM_PINNED
225-- DATA_SMALLARRAY
233-- DATA_SMALLARRAY
226-------------------------------------------------------------------------------
234-------------------------------------------------------------------------------