Skip to content

Commit 9b06c70

Browse files
committed
Removed benchmarks which are based on typed-protocols
They made a dependency loop between `io-sim` and `typed-protocols` making it harder than necessary to release a new version. They were not micro benchmarks anyway.
1 parent dcafd44 commit 9b06c70

File tree

2 files changed

+1
-52
lines changed

2 files changed

+1
-52
lines changed

io-sim/bench/Main.hs

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,15 @@ import Control.Monad (replicateM, forever)
88
import Control.Monad.Class.MonadAsync
99
import Control.Monad.Class.MonadFork
1010
import Control.Monad.Class.MonadSay
11-
import Control.Monad.Class.MonadThrow
1211
import Control.Monad.Class.MonadTimer
1312
import Control.Monad.IOSim
14-
import Control.Tracer (Tracer (..), emit, nullTracer)
1513

1614
import Criterion
1715
import Criterion.Main
1816

1917
import Control.Exception (AsyncException (..))
2018
import Data.Foldable (traverse_)
2119

22-
import Network.TypedProtocol.Channel
23-
import Network.TypedProtocol.Driver.Simple
24-
25-
import Network.TypedProtocol.PingPong.Client
26-
import Network.TypedProtocol.PingPong.Codec
27-
-- import qualified Network.TypedProtocol.PingPong.Codec.CBOR as CBOR
28-
import Network.TypedProtocol.PingPong.Examples
29-
import Network.TypedProtocol.PingPong.Server
30-
import Network.TypedProtocol.PingPong.Type
31-
32-
33-
prop_channel :: forall m. (MonadAsync m, MonadCatch m, MonadTimer m)
34-
=> Maybe (DiffTime, DiffTime)
35-
-> Int
36-
-> Tracer m (Role, TraceSendRecv PingPong)
37-
-> m Bool
38-
prop_channel delay n tr = do
39-
((), n') <- runConnectedPeers createChannel
40-
tr
41-
codecPingPongId client server
42-
return (n' == n)
43-
where
44-
createChannel :: forall a. m (Channel m a, Channel m a)
45-
createChannel =
46-
case delay of
47-
Nothing -> createConnectedChannels
48-
Just (d1, d2) -> (\(a, b) -> (delayChannel d1 a, delayChannel d2 b))
49-
<$> createConnectedChannels
50-
51-
client = pingPongClientPeer (pingPongClientCount n)
52-
server = pingPongServerPeer pingPongServerCount
5320

5421
--
5522
-- timers, delays, timeouts
@@ -101,22 +68,7 @@ prop_threadDelay_bottleneck =
10168

10269
main :: IO ()
10370
main = defaultMain
104-
[ env (let !n = 10000
105-
!d1 = 1
106-
!d2 = 2
107-
in pure (n, d1, d2))
108-
$ \ ~(n, d1, d2) ->
109-
bgroup "ping-pong"
110-
[ bench "stm channel without delay" $
111-
whnf id (runSimOrThrow (prop_channel Nothing n nullTracer))
112-
, bench "stm channel with delay" $
113-
whnf id (runSimOrThrow (prop_channel (Just (d1, d2)) n nullTracer))
114-
, bench "events" $
115-
nf id ( selectTraceEventsSay
116-
$ runSimTrace
117-
$ prop_channel Nothing n (Tracer $ emit $ say . show))
118-
]
119-
, env (pure ()) $ \_ ->
71+
[ env (pure ()) $ \_ ->
12072
bgroup "delays"
12173
[ bench "threadDelay" $
12274
whnf id (runSimOrThrow prop_threadDelay)

io-sim/io-sim.cabal

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ benchmark bench
110110
contra-tracer,
111111
io-classes,
112112
io-sim,
113-
typed-protocols >= 0.1.0.2,
114-
typed-protocols-cborg,
115-
typed-protocols-examples
116113
ghc-options: -Wall
117114
-Wcompat
118115
-Wincomplete-uni-patterns

0 commit comments

Comments
 (0)