[commit: stm] master: add some UNPACKs to improve performance a bit (9703c74)
Simon Marlow
marlowsd at gmail.com
Fri Jun 15 12:23:28 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/stm
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/9703c744181a6f71c4a6c836ac3b5be897da8b11
>---------------------------------------------------------------
commit 9703c744181a6f71c4a6c836ac3b5be897da8b11
Author: Simon Marlow <marlowsd at gmail.com>
Date: Tue Jun 12 10:56:43 2012 +0100
add some UNPACKs to improve performance a bit
>---------------------------------------------------------------
Control/Concurrent/STM/TChan.hs | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Control/Concurrent/STM/TChan.hs b/Control/Concurrent/STM/TChan.hs
index aea5176..713624e 100644
--- a/Control/Concurrent/STM/TChan.hs
+++ b/Control/Concurrent/STM/TChan.hs
@@ -43,11 +43,15 @@ import GHC.Conc
import Data.Typeable (Typeable)
+#define _UPK_(x) {-# UNPACK #-} !(x)
+
-- | 'TChan' is an abstract type representing an unbounded FIFO channel.
-data TChan a = TChan (TVar (TVarList a)) (TVar (TVarList a)) deriving Typeable
+data TChan a = TChan _UPK_(TVar (TVarList a))
+ _UPK_(TVar (TVarList a))
+ deriving Typeable
type TVarList a = TVar (TList a)
-data TList a = TNil | TCons a (TVarList a)
+data TList a = TNil | TCons a _UPK_(TVarList a)
-- |Build and returns a new instance of 'TChan'
newTChan :: STM (TChan a)
More information about the Cvs-libraries
mailing list