[commit: stm] master: add some UNPACKs to improve performance a bit (9703c74)

Simon Marlow <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.libraries
Message-ID <[email protected]>
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 <[email protected]>
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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.