File: Warp.hs

package info (click to toggle)
haskell-attoparsec 0.14.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 880 kB
  • sloc: haskell: 4,749; ansic: 170; makefile: 22
file content (16 lines) | stat: -rw-r--r-- 484 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE OverloadedStrings #-}

module Warp (benchmarks) where

import Test.Tasty.Bench (Benchmark, bench, bgroup, nf)
import Data.ByteString (ByteString)
import Network.Wai.Handler.Warp.ReadInt (readInt)
import qualified Data.Attoparsec.ByteString.Char8 as B

benchmarks :: Benchmark
benchmarks = bgroup "warp" [
    bgroup "decimal" [
      bench "warp" $ nf (readInt :: ByteString -> Int) "31337"
    , bench "atto" $ nf (B.parse (B.decimal :: B.Parser Int)) "31337"
    ]
  ]