Skip to content

Commit

Permalink
refactor: remove seq from bench (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrinberg authored Sep 24, 2024
1 parent b2e2837 commit fb4283f
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions benchmarks/benchmark.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,13 @@ let exec_bench_many exec name re cases =
;;

let rec read_all_http pos re reqs =
if pos >= String.length reqs
then ()
else (
if pos < String.length reqs
then (
let g = Re.exec ~pos re reqs in
let _, pos = Re.Group.offset g 0 in
read_all_http (pos + 1) re reqs)
;;

let rec drain_gen gen =
match gen () with
| Seq.Nil -> ()
| Cons (_, tail) -> drain_gen tail
;;

let string_traversal =
let open Bench in
let len = 1000 * 1000 in
Expand Down Expand Up @@ -112,8 +105,7 @@ let benchmarks =
let requests_g = Re.compile requests_g in
[ Test.create ~name:"execp no group" (fun () ->
ignore (Re.execp requests Http.requests))
; Test.create ~name:"all_gen group" (fun () ->
Http.requests |> Re.Seq.all requests_g |> drain_gen)
; Test.create ~name:"all_gen" (fun () -> Http.requests |> Re.all requests_g)
]
|> Test.create_group ~name:"auto"
in
Expand Down

0 comments on commit fb4283f

Please sign in to comment.