File: ParserBench.hs

package info (click to toggle)
haskell-http-link-header 1.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 112 kB
  • sloc: haskell: 309; makefile: 8
file content (17 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{-# LANGUAGE OverloadedStrings #-}

module ParserBench (benchmarks) where

import           Criterion
import           Network.HTTP.Link.Parser
import           Network.HTTP.Link.Types (Link)
import           Network.URI (URI)

benchmarks :: [Benchmark]
benchmarks = [
    bench "minimal" $ whnf parseLinkHeaderURI "<http://example.com>; rel=\"next\""
  , bench "large" $ whnf parseLinkHeaderURI "\n\t <  http://example.com>; rel=next; title=\"Hello world\",  <ftp://hello.world>; rev=license; someWeirdParam=\"YOLO LOL\", <https://long.ass.domain.name.just.because/lol>; rel=\"something something something http://some.thing/lol/rel\" "
  ]

  where
    parseLinkHeaderURI t = parseLinkHeader t :: Maybe [Link URI]