Skip to content

Commit

Permalink
Merge pull request #166 from tmcgilchrist/benchmark
Browse files Browse the repository at this point in the history
Setup uri-bench to build benchmarking code.
  • Loading branch information
tmcgilchrist authored Mar 20, 2023
2 parents 0ff3efb + 370c6d4 commit 4248b0f
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 29 deletions.
39 changes: 24 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,33 @@ jobs:
matrix:
os:
- macos-latest
ocaml-version:
- 4.12.0
- 4.11.1
- 4.10.0
- 4.09.1
- 4.08.2
ocaml-compiler:
- 5.0
- 4.14.1
- 4.13.1
- 4.08.1

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
uses: actions/checkout@v3
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-version: ${{ matrix.ocaml-version }}
- run: opam pin add . --no-action
- run: opam depext uri uri-sexp uri-re --yes --with-doc --with-test
- run: opam install . --deps-only --with-doc --with-test
- run: opam exec -- dune build
- run: opam exec -- dune runtest
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: Install dependencies
run: |
opam install . --deps-only --with-test
- name: Build
run: |
opam exec -- dune build
- name: Tests
run: |
opam exec -- dune build @runtest
- name: Opam Lint
run: |
opam lint uri.opam uri-re.opam uri-sexp.opam uri-bench.opam
6 changes: 4 additions & 2 deletions benchmarks/benchmark.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Core
open Core_bench.Std
open Core_bench

let make_bench_parsing (name, str) =
Bench.Test.create ~name
Expand Down Expand Up @@ -30,4 +30,6 @@ let benchmarks = [
(List.map ~f:make_bench_parsing parsing_benchs);
]

let () = Command.run (Bench.make_command benchmarks)
let () =
Bench.make_command benchmarks
|> Command_unix.run
4 changes: 3 additions & 1 deletion benchmarks/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
(executables
(names benchmark)
(libraries uri core_bench))
(package uri-bench)
(public_names uri-bench)
(libraries uri core_bench core_unix.command_unix))

(alias
(name bench)
Expand Down
16 changes: 5 additions & 11 deletions fuzz/dune
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
(executable
(name fuzz)
(libraries uri uri-re uri-sexp crowbar fmt))

(alias
(name fuzz)
(deps fuzz.exe (source_tree input))
(action (run
timeout --preserve-status 50m
bun -v --input=input --output=output -s
-- ./fuzz.exe)))
(tests
(names fuzz)
(package uri)
(libraries uri uri-re crowbar)
(deps (source_tree input)))
25 changes: 25 additions & 0 deletions uri-bench.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
opam-version: "2.0"
maintainer: "[email protected]"
authors: ["Anil Madhavapeddy" "David Sheets" "Rudi Grinberg"]
license: "ISC"
tags: ["url" "uri" "org:mirage" "org:xapi-project"]
homepage: "https://github.com/mirage/ocaml-uri"
bug-reports: "https://github.com/mirage/ocaml-uri/issues"
dev-repo: "git+https://github.com/mirage/ocaml-uri.git"
doc: "https://mirage.github.io/ocaml-uri/"
synopsis: "Benchmarking package for ocaml-uri"
description: """
This is a benchmarking package for the OCaml implementation of the [RFC3986](http://tools.ietf.org/html/rfc3986) specification for parsing URI or URLs.
"""
depends: [
"ocaml" {>= "4.04.0"}
"dune" {>= "1.2.0"}
"uri" {= version}
"core_bench" {with-test & >= "v0.14.0"}
"core_unix" {with-test & >= "v0.14.0"}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
1 change: 1 addition & 0 deletions uri.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ depends: [
"dune" {>= "1.2.0"}
"ounit" {with-test & >= "1.0.2"}
"ppx_sexp_conv" {with-test & >= "v0.9.0"}
"crowbar" {with-test & >= "0.2"}
"stringext" {>= "1.4.0"}
"angstrom" {>= "0.14.0"}
]
Expand Down

0 comments on commit 4248b0f

Please sign in to comment.