diff options
-rw-r--r-- | bench/Main.hs | 17 | ||||
-rw-r--r-- | bench/Server.hs | 11 | ||||
-rw-r--r-- | krpc.cabal | 36 |
3 files changed, 53 insertions, 11 deletions
diff --git a/bench/Main.hs b/bench/Main.hs new file mode 100644 index 00000000..411282a0 --- /dev/null +++ b/bench/Main.hs | |||
@@ -0,0 +1,17 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | ||
2 | module Main (main) where | ||
3 | |||
4 | import Criterion.Main | ||
5 | import Remote.KRPC | ||
6 | |||
7 | |||
8 | addr :: RemoteAddr | ||
9 | addr = (0, 6000) | ||
10 | |||
11 | echo :: Method [Int] [Int] | ||
12 | echo = method "echo" ["x"] ["x"] | ||
13 | |||
14 | main :: IO () | ||
15 | main = defaultMain $ map mkbench [1, 10, 100, 1000] | ||
16 | where | ||
17 | mkbench n = bench (show n) $ nfIO $ call addr echo [1..n] \ No newline at end of file | ||
diff --git a/bench/Server.hs b/bench/Server.hs new file mode 100644 index 00000000..cb5ed316 --- /dev/null +++ b/bench/Server.hs | |||
@@ -0,0 +1,11 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | ||
2 | module Main (main) where | ||
3 | |||
4 | import Remote.KRPC | ||
5 | |||
6 | |||
7 | echo :: Method [Int] [Int] | ||
8 | echo = method "echo" ["x"] ["x"] | ||
9 | |||
10 | main :: IO () | ||
11 | main = server 6000 [ echo ==> return ] | ||
@@ -13,6 +13,11 @@ bug-reports: https://github.com/pxqr/krpc/issues | |||
13 | synopsis: KRPC remote procedure call protocol implementation. | 13 | synopsis: KRPC remote procedure call protocol implementation. |
14 | description: KRPC remote procedure call protocol implementation. | 14 | description: KRPC remote procedure call protocol implementation. |
15 | 15 | ||
16 | source-repository head | ||
17 | type: git | ||
18 | location: https://github.com/pxqr/krpc.git | ||
19 | |||
20 | |||
16 | 21 | ||
17 | library | 22 | library |
18 | exposed-modules: Remote.KRPC | 23 | exposed-modules: Remote.KRPC |
@@ -38,22 +43,31 @@ library | |||
38 | 43 | ||
39 | 44 | ||
40 | 45 | ||
41 | executable echo-client | 46 | |
47 | executable exsample-client | ||
42 | main-is: Client.hs | 48 | main-is: Client.hs |
43 | other-modules: Shared | 49 | other-modules: Shared |
44 | 50 | build-depends: base == 4.*, krpc | |
45 | build-depends: base == 4.* | ||
46 | , krpc | ||
47 | |||
48 | hs-source-dirs: examples | 51 | hs-source-dirs: examples |
49 | 52 | ||
50 | 53 | executable exsample-server | |
51 | |||
52 | executable echo-server | ||
53 | main-is: Server.hs | 54 | main-is: Server.hs |
54 | other-modules: Shared | 55 | other-modules: Shared |
56 | build-depends: base == 4.*, krpc | ||
57 | hs-source-dirs: examples | ||
55 | 58 | ||
56 | build-depends: base == 4.* | ||
57 | , krpc | ||
58 | 59 | ||
59 | hs-source-dirs: examples | 60 | |
61 | |||
62 | executable bench-server | ||
63 | main-is: Server.hs | ||
64 | build-depends: base == 4.*, krpc | ||
65 | hs-source-dirs: bench | ||
66 | ghc-options: -O2 | ||
67 | |||
68 | benchmark bench-client | ||
69 | type: exitcode-stdio-1.0 | ||
70 | main-is: Main.hs | ||
71 | hs-source-dirs: bench | ||
72 | build-depends: base == 4.5.*, krpc, criterion | ||
73 | ghc-options: -O2 \ No newline at end of file | ||