Skip to content

Commit

Permalink
test: benchmark Header.mem
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrinberg committed Jan 7, 2022
1 parent efe0599 commit 8b835ae
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions http/bench/bench.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module Command = Core.Command
module Staged = Core.Staged
open Core_bench

let header_mem =
let variations =
[
[ ("foo", "bar") ];
[ ("transfer-encoding", "bar") ];
[ ("traNsfer-eNcoding", "bar") ];
[ ("traNsfer eNcoding", "bar") ];
]
in
List.mapi
(fun i header ->
Bench.Test.create
~name:("Header.mem - " ^ string_of_int i)
(fun () ->
let key = "transfer-encoding" in
let header = Http.Header.of_list header in
Staged.stage @@ fun () ->
let (_ : bool) = Http.Header.mem header key in
()))
variations

let () = Command.run @@ Bench.make_command header_mem
3 changes: 3 additions & 0 deletions http/bench/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name bench)
(libraries http core core_bench))

0 comments on commit 8b835ae

Please sign in to comment.