packages feed

snap-server 0.2.7 → 0.2.7.1

raw patch · 4 files changed

+60/−8 lines, 4 files

Files

snap-server.cabal view
@@ -1,5 +1,5 @@ name:           snap-server-version:        0.2.7+version:        0.2.7.1 synopsis:       A fast, iteratee-based, epoll-enabled web server for the Snap Framework description:   This is the first developer prerelease of the Snap framework.  Snap is a@@ -55,6 +55,8 @@   LICENSE,   README.md,   README.SNAP.md,+  test/benchmark/Benchmark.hs,+  test/benchmark/Snap/Internal/Http/Parser/Benchmark.hs,   test/data/fileServe/foo.bin,   test/data/fileServe/foo.bin.bin.bin,   test/data/fileServe/foo.html,@@ -92,7 +94,8 @@     Paths_snap_server,     Snap.Internal.Http.Parser,     Snap.Internal.Http.Server,  -    Snap.Internal.Http.Server.Date+    Snap.Internal.Http.Server.Date,+    System.SendFile    build-depends:     array >= 0.2 && <0.4,
src/Snap/Internal/Http/Server/LibevBackend.hs view
@@ -376,13 +376,12 @@  -- | throw a timeout exception to the handling thread -- it'll clean up -- everything-timerCallback :: MVar ()           -- ^ loop lock-              -> EvLoopPtr         -- ^ loop obj+timerCallback :: EvLoopPtr         -- ^ loop obj               -> EvTimerPtr        -- ^ timer obj               -> IORef CTime       -- ^ when to timeout?               -> MVar ThreadId     -- ^ thread to kill               -> TimerCallback-timerCallback lock loop tmr ioref tmv _ _ _ = do+timerCallback loop tmr ioref tmv _ _ _ = do     debug "Backend.timerCallback: entered"      now       <- getCurrentDateTime@@ -394,7 +393,7 @@           tid <- readMVar tmv           throwTo tid TimeoutException -      else withMVar lock $ \_ -> do    -- re-arm the timer+      else do    -- re-arm the timer           -- fixme: should set repeat here, have to wait for an hlibev patch to           -- do it           evTimerAgain loop tmr@@ -570,8 +569,7 @@         thrmv       <- newEmptyMVar         now         <- getCurrentDateTime         timeoutTime <- newIORef $ now + 20-        tcb         <- mkTimerCallback $ timerCallback (_loopLock backend)-                                                       lp+        tcb         <- mkTimerCallback $ timerCallback lp                                                        tmr                                                        timeoutTime                                                        thrmv
+ test/benchmark/Benchmark.hs view
@@ -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+       ]
+ test/benchmark/Snap/Internal/Http/Parser/Benchmark.hs view
@@ -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 ]