{-# LANGUAGE OverloadedStrings #-}
module Main where
import System.Environment
import qualified Web.Scotty as Scotty
import Web.Spock
import Web.Spock.Config
import Data.Text (pack)
app :: SpockM () () () ()
app = do
get "/echo/hello-world" $
text "Hello World"
get ("echo" <//> "plain" <//> var) $ \param ->
text $ param
get ("echo" <//> "regex" <//> var) $ \num ->
text $ pack $ show (num::Int)
main =
do args <- getArgs
let port = 8181
case args of
["scotty"] ->
Scotty.scotty port $
do Scotty.get "/echo/hello-world" $
Scotty.text "Hello World"
Scotty.get "/echo/plain/:param" $
do p <- Scotty.param "param"
Scotty.text p
Scotty.get (Scotty.regex "^/echo/regex/([0-9]+)$") $
do p <- Scotty.param "1"
Scotty.text p
["spock"] -> do
cfg <- defaultSpockCfg () PCNoDatabase ()
runSpock port (spock cfg app)
_ -> putStrLn "Usage: ./Spock-scotty-benchmark spock|scotty"
Hi, I'm trying to run the benchmark(https://github.com/agrafix/Spock-scotty-benchmark) updating the Spock version to 0.13 but If I do, the metrics have gone down to ~6k request/sec from ~60k. Can you please let me know what I'm doing wrong? With the same code the scotty version works fine. Scotty-results.txt Spock-results.txt
and my cabal file changes are,
Any help would be highly appreciated, Thanks in advance.