Skip to content

Commit

Permalink
bench: split on whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrinberg committed Oct 14, 2024
1 parent 8a74bc2 commit 16eae84
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions benchmarks/benchmark.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ let repeated_sequence =
ignore (Re.execp re s))
;;

let split =
let s = Bytes.make 1_000 '_' in
for i = 0 to 100 do
Bytes.set s (i * 9) ' '
done;
let s = Bytes.to_string s in
let re () = Re.(rep1 space |> compile) in
test ~name:"split on whitespace" re (fun re -> ignore (Re.split_full (re ()) s))
;;

let benchmarks =
let benches =
List.map benchmarks ~f:(fun (name, re, cases) ->
Expand Down Expand Up @@ -144,6 +154,7 @@ let benchmarks =
@ compile_clean_star
@ Memory.benchmarks
@ repeated_sequence
@ split
;;

let () =
Expand Down

0 comments on commit 16eae84

Please sign in to comment.