git.iko.soy/distributed-process
on master help sign in
Cleanup. Relax upper bound on network.
commita307db2171885af7737580e07fdad6f6bc538f35 authorEdsko de Vries <edsko@edsko.net> dateFri 28 Sep 2012, 09:30 (14 years ago) parentbd36d06
3 files changed+13−16
distributed-process/benchmarks/Throughput.hs+9−12 distributed-process/distributed-process.cabal+2−2 network-transport-tcp/network-transport-tcp.cabal+2−2
distributed-process/benchmarks/Throughput.hs+9−12
@@ -21,7 +21,7 @@ instance Binary a => Binary (SizedList a) where
2121
2222-- Copied from Data.Binary
2323getMany :: Binary a => Int -> Get [a]
24−getMany n = go [] n
24+getMany = go []
2525 where
2626 go xs 0 = return $! reverse xs
2727 go xs i = do x <- get
@@ -38,22 +38,19 @@ counter :: Process ()
3838counter = go 0
3939 where
4040 go :: Int -> Process ()
41− go !n = do
42− msg <- receiveWait
43− [ match $ \xs -> return . Left . size $ (xs :: SizedList Int)
44− , match $ \them -> return . Right $ them
41+ go !n =
42+ receiveWait
43+ [ match $ \xs -> go (n + size (xs :: SizedList Int))
44+ , match $ \them -> send them n >> go 0
4545 ]
46− case msg of
47− Left n' -> go (n + n')
48− Right them -> send them n >> go 0
4946
5047count :: (Int, Int) -> ProcessId -> Process ()
51−count (packets, size) them = do
48+count (packets, sz) them = do
5249 us <- getSelfPid
53− replicateM_ packets $ send them (nats size)
50+ replicateM_ packets $ send them (nats sz)
5451 send them us
5552 n' <- expect
56− liftIO $ print (packets * size, n' == packets * size)
53+ liftIO $ print (packets * sz, n' == packets * sz)
5754
5855initialProcess :: String -> Process ()
5956initialProcess "SERVER" = do
@@ -61,7 +58,7 @@ initialProcess "SERVER" = do
6158 liftIO $ BSL.writeFile "counter.pid" (encode us)
6259 counter
6360initialProcess "CLIENT" = do
64− n <- liftIO $ getLine
61+ n <- liftIO getLine
6562 them <- liftIO $ decode <$> BSL.readFile "counter.pid"
6663 count (read n) them
6764
distributed-process/distributed-process.cabal+2−2
@@ -92,7 +92,7 @@ Test-Suite TestCH
9292 network-transport >= 0.3 && < 0.4,
9393 network-transport-tcp >= 0.3 && < 0.4,
9494 binary >= 0.5 && < 0.6,
95− network >= 2.3 && < 2.4
95+ network >= 2.3 && < 2.5
9696 Other-modules: TestAuxiliary
9797 Extensions: CPP,
9898 ScopedTypeVariables,
@@ -112,7 +112,7 @@ Test-Suite TestClosure
112112 network-transport >= 0.3 && < 0.4,
113113 network-transport-tcp >= 0.3 && < 0.4,
114114 bytestring >= 0.9 && < 0.11,
115− network >= 2.3 && < 2.4
115+ network >= 2.3 && < 2.5
116116 Other-modules: TestAuxiliary
117117 Extensions: CPP,
118118 ScopedTypeVariables
network-transport-tcp/network-transport-tcp.cabal+2−2
@@ -26,7 +26,7 @@ Library
2626 data-accessor >= 0.2 && < 0.3,
2727 containers >= 0.4 && < 0.6,
2828 bytestring >= 0.9 && < 0.11,
29− network >= 2.3 && < 2.4
29+ network >= 2.3 && < 2.5
3030 Exposed-modules: Network.Transport.TCP,
3131 Network.Transport.TCP.Internal
3232 Extensions: CPP
@@ -38,7 +38,7 @@ Test-Suite TestTCP
3838 Main-Is: TestTCP.hs
3939 Build-Depends: base >= 4.3 && < 5,
4040 network-transport-tests >= 0.1 && < 0.2,
41− network >= 2.3 && < 2.4,
41+ network >= 2.3 && < 2.5,
4242 network-transport >= 0.3 && < 0.4,
4343 network-transport-tcp >= 0.3 && < 0.4
4444 ghc-options: -threaded -rtsopts -with-rtsopts=-N