File: bench.ml

package info (click to toggle)
ocaml-cohttp 6.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,624 kB
  • sloc: ml: 13,107; makefile: 20; sh: 18; javascript: 18
file content (29 lines) | stat: -rw-r--r-- 665 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Command = Core.Command
module Staged = Core.Staged
open Core_bench

let header_names =
  [
    "Accept";
    "Accept-Encoding";
    "Accept-Language";
    "Cache-Control";
    "Connection";
    "Host";
    "If-Modified-Since";
    "If-None-Match";
    "Origin";
    "Referer";
    "Sec-Fetch-Dest";
    "Sec-Fetch-Mode";
    "Sec-Fetch-Site";
  ]

let header =
  header_names |> List.map (fun s -> (s, "value")) |> Http.Header.of_list

let bench_header_mem =
  Bench.Test.create ~name:"Header.mem" (fun () ->
      List.iter (fun key -> assert (Http.Header.mem header key)) header_names)

let () = Command_unix.run @@ Bench.make_command [ bench_header_mem ]