git.iko.soy/typeable/attoparsec
on 0.13.0.1 help sign in
17 lines 506 B history raw
1{-# LANGUAGE OverloadedStrings #-}
3module Warp (benchmarks) where
5import Criterion.Main (bench, bgroup, nf)
6import Criterion.Types (Benchmark)
7import Data.ByteString (ByteString)
8import Network.Wai.Handler.Warp.ReadInt (readInt)
9import qualified Data.Attoparsec.ByteString.Char8 as B
11benchmarks :: Benchmark
12benchmarks = bgroup "warp" [
13 bgroup "decimal" [
14 bench "warp" $ nf (readInt :: ByteString -> Int) "31337"
15 , bench "atto" $ nf (B.parse (B.decimal :: B.Parser Int)) "31337"
16 ]
17 ]