This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap-server".
The branch, master has been updated
via 7c1cf61568f51eebb762599753708415e46ee8e4 (commit)
from 180642bd0246cb33f86de6a54847f3576b09131e (commit)
Summary of changes:
test/benchmark/Benchmark.hs | 15 ++++++++
.../Snap/Internal/Http/Parser/Benchmark.hs | 36 ++++++++++++++++++++
test/snap-server-testsuite.cabal | 14 ++++++-
3 files changed, 63 insertions(+), 2 deletions(-)
create mode 100644 test/benchmark/Benchmark.hs
create mode 100644 test/benchmark/Snap/Internal/Http/Parser/Benchmark.hs
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7c1cf61568f51eebb762599753708415e46ee8e4
Author: Aycan iRiCAN <[email protected]>
Date: Thu Jun 3 02:57:21 2010 +0300
Added benchmarks with Criterion.
Get a list of benchmarks:
dist/build/benchmark/benchmark -l
Execute a benchmark:
dist/build/benchmark/benchmark parser/firefoxget
diff --git a/test/benchmark/Benchmark.hs b/test/benchmark/Benchmark.hs
new file mode 100644
index 0000000..7fb7461
--- /dev/null
+++ b/test/benchmark/Benchmark.hs
@@ -0,0 +1,15 @@
+module Main where
+
+import Criterion.Main
+
+import qualified Snap.Internal.Http.Parser.Benchmark as PB
+
+fib :: Int -> Int
+fib 0 = 0
+fib 1 = 1
+fib n = fib (n-1) + fib (n-2)
+
+main :: IO ()
+main = defaultMain [
+ PB.benchmarks
+ ]
diff --git a/test/benchmark/Snap/Internal/Http/Parser/Benchmark.hs
b/test/benchmark/Snap/Internal/Http/Parser/Benchmark.hs
new file mode 100644
index 0000000..1eac323
--- /dev/null
+++ b/test/benchmark/Snap/Internal/Http/Parser/Benchmark.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+
+module Snap.Internal.Http.Parser.Benchmark
+ ( benchmarks )
+ where
+
+import Criterion.Main
+import Snap.Internal.Http.Parser
+import Data.ByteString (ByteString)
+import qualified Data.ByteString as S
+import qualified Snap.Iteratee as SI
+import qualified Control.Exception as E
+import Data.Attoparsec hiding (Result(..))
+
+req1 = S.concat
+ [ "GET /favicon.ico HTTP/1.1\r\n"
+ , "Host: 0.0.0.0=5000\r\n"
+ , "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9)
Gecko/2008061015 Firefox/3.0\r\n"
+ , "Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
+ , "Accept-Language: en-us,en;q=0.5\r\n"
+ , "Accept-Encoding: gzip,deflate\r\n"
+ , "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"
+ , "Keep-Alive: 300\r\n"
+ , "Connection: keep-alive\r\n"
+ , "\r\n" ]
+
+test1 :: IO ()
+test1 = do
+ i <- SI.enumBS req1 parseRequest
+ f <- SI.run i
+ return ()
+
+benchmarks = bgroup "parser"
+ [ bench "firefoxget" $ whnfIO test1 ]
\ No newline at end of file
diff --git a/test/snap-server-testsuite.cabal b/test/snap-server-testsuite.cabal
index 1a7c9d1..bc6650a 100644
--- a/test/snap-server-testsuite.cabal
+++ b/test/snap-server-testsuite.cabal
@@ -34,7 +34,7 @@ Executable testsuite
HTTP >= 4000.0.9 && < 4001,
HUnit >= 1.2 && < 2,
monads-fd,
- network == 2.2.1.*,
+ network == 2.2.1.7,
network-bytestring >= 0.1.2 && < 0.2,
old-locale,
parallel > 2,
@@ -91,7 +91,7 @@ Executable pongserver
old-locale,
parallel > 2,
iteratee >= 0.3.1 && < 0.4,
- network == 2.2.1.*,
+ network == 2.2.1.7,
network-bytestring >= 0.1.2 && < 0.2,
sendfile >= 0.6.1 && < 0.7,
snap-core >= 0.2.1 && <0.3,
@@ -125,3 +125,13 @@ Executable pongserver
ghc-options: -Wall -O2 -fwarn-tabs -funbox-strict-fields -threaded
-fno-warn-unused-do-bind
ghc-prof-options: -prof -auto-all
+
+Executable benchmark
+ hs-source-dirs: benchmark ../src
+ main-is: Benchmark.hs
+ build-depends:
+ base >= 4 && < 5,
+ network == 2.2.1.7,
+ HTTP >= 4000.0.9 && < 4001,
+ criterion == 0.5.0.0
+
\ No newline at end of file
-----------------------------------------------------------------------
hooks/post-receive
--
snap-server
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap