Skip to content

Commit

Permalink
Merge pull request #5909 from kit-ty-kate/bench-deps-only-installed-pkg
Browse files Browse the repository at this point in the history
Benchmark opam install --deps-only of an already installed package
  • Loading branch information
kit-ty-kate authored May 3, 2024
2 parents bff312b + 7e30847 commit b3d2f5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ users)
## Test

## Benchmarks
* Benchmark opam install --deps-only of an already installed package [#5909 @kit-ty-kate]

## Reftests
### Tests
Expand Down
13 changes: 13 additions & 0 deletions tests/bench/bench.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ let () =
time_cmd ~exit:0 (fmt "%s install magic-trace -y --fake --sw two" bin)
in
let time_OpamSystem_read_10 =
(* NOTE: https://github.com/ocaml/opam/pull/5896 *)
let time_OpamSystem_read () =
let ic = Stdlib.open_in_bin "/home/opam/all-opam-files" in
let before = Unix.gettimeofday () in
Expand All @@ -48,6 +49,12 @@ let () =
let l = List.init n (fun _ -> time_OpamSystem_read ()) in
List.fold_left (+.) 0.0 l /. float_of_int n
in
let time_deps_only_installed_pkg =
(* NOTE: https://github.com/ocaml/opam/pull/5908 *)
launch (fmt "%s switch create three --fake ocaml-base-compiler.4.14.0" bin);
launch (fmt "%s install -y --fake core.v0.15.0" bin);
time_cmd ~exit:0 (fmt "%s install --show --deps-only core.v0.15.0" bin)
in
let json = fmt {|{
"results": [
{
Expand All @@ -72,6 +79,11 @@ let () =
"name": "OpamSystem.read amortised over 10 runs",
"value": %f,
"units": "secs"
},
{
"name": "Deps-only install of an already installed package",
"value": %f,
"units": "secs"
}
]
},
Expand All @@ -91,6 +103,7 @@ let () =
time_install_cmd
time_install_cmd_w_invariant
time_OpamSystem_read_10
time_deps_only_installed_pkg
bin_size
in
print_endline json

0 comments on commit b3d2f5c

Please sign in to comment.