summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bench/Main.hs17
-rw-r--r--bench/Server.hs11
-rw-r--r--krpc.cabal36
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 #-}
2module Main (main) where
3
4import Criterion.Main
5import Remote.KRPC
6
7
8addr :: RemoteAddr
9addr = (0, 6000)
10
11echo :: Method [Int] [Int]
12echo = method "echo" ["x"] ["x"]
13
14main :: IO ()
15main = 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 #-}
2module Main (main) where
3
4import Remote.KRPC
5
6
7echo :: Method [Int] [Int]
8echo = method "echo" ["x"] ["x"]
9
10main :: IO ()
11main = server 6000 [ echo ==> return ]
diff --git a/krpc.cabal b/krpc.cabal
index 0c63711f..97c903b9 100644
--- a/krpc.cabal
+++ b/krpc.cabal
@@ -13,6 +13,11 @@ bug-reports: https://github.com/pxqr/krpc/issues
13synopsis: KRPC remote procedure call protocol implementation. 13synopsis: KRPC remote procedure call protocol implementation.
14description: KRPC remote procedure call protocol implementation. 14description: KRPC remote procedure call protocol implementation.
15 15
16source-repository head
17 type: git
18 location: https://github.com/pxqr/krpc.git
19
20
16 21
17library 22library
18 exposed-modules: Remote.KRPC 23 exposed-modules: Remote.KRPC
@@ -38,22 +43,31 @@ library
38 43
39 44
40 45
41executable echo-client 46
47executable 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 53executable exsample-server
51
52executable 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
62executable bench-server
63 main-is: Server.hs
64 build-depends: base == 4.*, krpc
65 hs-source-dirs: bench
66 ghc-options: -O2
67
68benchmark 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