[Haskell-cafe] warp vs scotty + some benchmark numbers

Miro Karpis miroslav.karpis at gmail.com
Sat Apr 12 21:22:01 UTC 2014

I'm trying to make a small benchmarking for warp and scotty (later with
json/no-json text performance test). My client is a Qt c++ application. I
made a minimum code in both Haskell and C++. The problem is the numbers I'm

(Benchmark::pong-warp) - total requests: 10000 , send/received in msec:

(Benchmark::pong-scotty) - total requests: 10000 , send/received in msec:

Only sending 10k requests from my c++ client takes around 1 sec.

What I don't understand is:
a) how is it possible that scotty is so close to warp (in this run it even
b) 10k requests I'm getting in approximately 4 seconds.
one 2 years old benchmark with 80k/second. Why is there so big

I'm running on macbook-pro 16g, 2.3 GHz

Scotty and warp is compiled with: -O2 -threaded

import Web.Scotty
import Data.Monoid (mconcat)

main = scotty 3005 $ do

  get "/" $ do
    text "pong"

import Network.Wai(responseLBS, Application)
import Network.HTTP.Types(status200)
import Network.Wai.Handler.Warp (run)

app :: Application
app _ = return $ responseLBS
    [("Content-Type", "text/plain")]

main :: IO ()
main = do
let port = 3000
putStrLn $ "Listening on port " ++ show port
run port app

--c++ client sample (Qt)

    simStart = QDateTime().currentMSecsSinceEpoch();

    for(int i=0; i<requests; i++){

        QNetworkReply *reply = manager->get(QNetworkRequest(url));

        QEventLoop eventLoop;

        QObject::connect(manager, SIGNAL(finished(QNetworkReply *)),
&eventLoop, SLOT(quit()));


        QObject::disconnect(manager, SIGNAL(finished(QNetworkReply
*)), &eventLoop, SLOT(quit()));


    qDebug() << "(Benchmark::pong) - total requests: " << requests <<
", send in msec: " << (QDateTime().currentMSecsSinceEpoch()-simStart);


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140412/67e27ac0/attachment.html>

More information about the Haskell-Cafe mailing list