diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-05-14 10:27:36 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-05-14 10:27:36 +0400 |
commit | d0038e9bde22751c9c926796a6c46be62a3cb81b (patch) | |
tree | d0955ea60d53d672f10e1e7c3be065a65b4193a6 /bench | |
parent | a2bc26abbe6ccea464c04b990f8a4a8fa769ba2a (diff) |
~ Minor changes.
Diffstat (limited to 'bench')
-rw-r--r-- | bench/Main.hs | 11 | ||||
-rw-r--r-- | bench/Server.hs | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/bench/Main.hs b/bench/Main.hs index 411282a0..87d39f14 100644 --- a/bench/Main.hs +++ b/bench/Main.hs | |||
@@ -1,6 +1,9 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | 1 | {-# LANGUAGE OverloadedStrings #-} |
2 | module Main (main) where | 2 | module Main (main) where |
3 | 3 | ||
4 | import Control.Monad | ||
5 | import Data.ByteString (ByteString) | ||
6 | import qualified Data.ByteString as B | ||
4 | import Criterion.Main | 7 | import Criterion.Main |
5 | import Remote.KRPC | 8 | import Remote.KRPC |
6 | 9 | ||
@@ -8,10 +11,12 @@ import Remote.KRPC | |||
8 | addr :: RemoteAddr | 11 | addr :: RemoteAddr |
9 | addr = (0, 6000) | 12 | addr = (0, 6000) |
10 | 13 | ||
11 | echo :: Method [Int] [Int] | 14 | echo :: Method ByteString ByteString |
12 | echo = method "echo" ["x"] ["x"] | 15 | echo = method "echo" ["x"] ["x"] |
13 | 16 | ||
14 | main :: IO () | 17 | main :: IO () |
15 | main = defaultMain $ map mkbench [1, 10, 100, 1000] | 18 | main = defaultMain $ map (mkbench 1) [1, 10, 100, 1000, 32 * 1024] |
19 | ++ map (mkbench 10) [1, 10, 100, 1000] | ||
16 | where | 20 | where |
17 | mkbench n = bench (show n) $ nfIO $ call addr echo [1..n] \ No newline at end of file | 21 | mkbench r n = bench (show r ++ "/" ++ show n) $ nfIO $ |
22 | replicateM r $ call addr echo (B.replicate n 0) \ No newline at end of file | ||
diff --git a/bench/Server.hs b/bench/Server.hs index cb5ed316..ece5a7a9 100644 --- a/bench/Server.hs +++ b/bench/Server.hs | |||
@@ -1,10 +1,11 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | 1 | {-# LANGUAGE OverloadedStrings #-} |
2 | module Main (main) where | 2 | module Main (main) where |
3 | 3 | ||
4 | import Data.ByteString (ByteString) | ||
4 | import Remote.KRPC | 5 | import Remote.KRPC |
5 | 6 | ||
6 | 7 | ||
7 | echo :: Method [Int] [Int] | 8 | echo :: Method ByteString ByteString |
8 | echo = method "echo" ["x"] ["x"] | 9 | echo = method "echo" ["x"] ["x"] |
9 | 10 | ||
10 | main :: IO () | 11 | main :: IO () |