Skip to content

Commit

Permalink
refactor: move texignore bench
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrinberg committed Sep 24, 2024
1 parent 7f76b7a commit 43c8d64
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
18 changes: 1 addition & 17 deletions benchmarks/benchmark.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,6 @@ let http_requests = Stdio.In_channel.read_all "benchmarks/http-requests.txt"
let str_20_zeroes = String.make 20 '0'
let re_20_zeroes = Re.(str str_20_zeroes)

let tex_ignore_re =
Stdio.In_channel.read_lines "benchmarks/tex.gitignore"
|> List.map ~f:(fun s ->
match Base.String.lsplit2 s ~on:'#' with
| Some (pattern, _comment) -> pattern
| None -> s)
|> List.filter_map ~f:(fun s ->
match Base.String.strip s with
| "" -> None
| s -> Some s)
|> List.map ~f:Re.Glob.glob
|> Re.alt
;;

let tex_ignore_filesnames = Stdio.In_channel.read_lines "benchmarks/files"

let lots_of_a's =
String.init 101 ~f:(function
| 100 -> 'b'
Expand Down Expand Up @@ -171,7 +155,7 @@ let benchmarks =
in
benches
@ [ [ exec_bench_many Re.execp "execp"; exec_bench_many Re.exec_opt "exec_opt" ]
|> List.map ~f:(fun f -> f tex_ignore_re tex_ignore_filesnames)
|> List.map ~f:(fun f -> f Tex.ignore_re Tex.ignore_filesnames)
|> Bench.Test.create_group ~name:"tex gitignore"
]
@ [ http_benches ]
Expand Down
17 changes: 17 additions & 0 deletions benchmarks/tex.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
open Core

let ignore_re =
Stdio.In_channel.read_lines "benchmarks/tex.gitignore"
|> List.map ~f:(fun s ->
match Base.String.lsplit2 s ~on:'#' with
| Some (pattern, _comment) -> pattern
| None -> s)
|> List.filter_map ~f:(fun s ->
match Base.String.strip s with
| "" -> None
| s -> Some s)
|> List.map ~f:Re.Glob.glob
|> Re.alt
;;

let ignore_filesnames = Stdio.In_channel.read_lines "benchmarks/files"

0 comments on commit 43c8d64

Please sign in to comment.