blob: 697ecce9421de625dedd310179c4de40fcffee25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Control.Monad
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import Criterion.Main
import Remote.KRPC
addr :: RemoteAddr
addr = (0, 6000)
echo :: Method ByteString ByteString
echo = method "echo" ["x"] ["x"]
main :: IO ()
main = withRemote $ \remote -> do {
; let sizes = [10, 100, 1000, 10000, 16 * 1024]
; let repetitions = [1, 10, 100, 1000]
; let params = [(r, s) | r <- repetitions, s <- sizes]
; let benchmarks = map (uncurry (mkbench_ remote)) params
; defaultMain benchmarks
}
where
mkbench_ re r n = bench (show r ++ "/" ++ show n) $ nfIO $
replicateM r $ call_ re addr echo (B.replicate n 0)
{-
forM_ [1..] $ const $ do
async addr myconcat (replicate 100 [1..10])
-}
|