Commit 03315612 authored by rl@cse.unsw.edu.au's avatar rl@cse.unsw.edu.au
Browse files

Use unboxed types in PA when possible

parent ecf00bf5
......@@ -6,4 +6,5 @@ module Data.Array.Parallel.Lifted (
import Data.Array.Parallel.Lifted.PArray
import Data.Array.Parallel.Lifted.Closure
import Data.Array.Parallel.Lifted.Tuple
......@@ -53,7 +53,7 @@ AClo _ f es $:^ as = f es as
instance (PA a, PA b) => PA (a :-> b) where
{-# INLINE lengthPA #-}
lengthPA (AClo _ _ es) = lengthPA es
lengthPA (AClo _ _ es) = lengthPA es
{-# INLINE replicatePA #-}
replicatePA n (Clo f f' e) = AClo f f' (replicatePA n e)
replicatePA n# (Clo f f' e) = AClo f f' (replicatePA n# e)
......@@ -2,6 +2,8 @@ module Data.Array.Parallel.Lifted.PArray (
PArray, PA(..)
) where
import GHC.Exts (Int#)
-- |Lifted parallel arrays
--
data family PArray a
......@@ -9,6 +11,6 @@ data family PArray a
-- |Dictionaries
--
class PA a where
lengthPA :: PArray a -> Int
replicatePA :: Int -> a -> PArray a
lengthPA :: PArray a -> Int#
replicatePA :: Int# -> a -> PArray a
......@@ -3,7 +3,9 @@ where
import Data.Array.Parallel.Lifted.PArray
data instance PArray () = PUnit !Int ()
import GHC.Exts (Int#)
data instance PArray () = PUnit Int# ()
instance PA () where
{-# INLINE lengthPA #-}
......@@ -76,7 +78,7 @@ data STup4 a b c d = STup4 !a !b !c !d
data STup5 a b c d e = STup5 !a !b !c !d !e
-}
data instance PArray (a,b) = PTup2 !Int (PArray a) (PArray b)
data instance PArray (a,b) = PTup2 Int# (PArray a) (PArray b)
instance (PA a, PA b) => PA (a,b) where
{-# INLINE lengthPA #-}
......@@ -87,7 +89,7 @@ instance (PA a, PA b) => PA (a,b) where
where
(a,b) = p
data instance PArray (a,b,c) = PTup3 !Int (PArray a)
data instance PArray (a,b,c) = PTup3 Int# (PArray a)
(PArray b)
(PArray c)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment