Skip to content

Commit

Permalink
Merge pull request #6123 from kit-ty-kate/bench-install-check
Browse files Browse the repository at this point in the history
Benchmark opam install --check
  • Loading branch information
rjbou authored Aug 5, 2024
2 parents f6b4091 + 8b4a4af commit 6b65594
Show file tree
Hide file tree
Showing 2 changed files with 24 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 @@ -128,6 +128,7 @@ users)
## Benchmarks
* Make the benchmark setup process faster and the benchmark itself more stable [#6094 @kit-ty-kate]
* Add a benchmark showing the current performance of OpamVersionCompare [#6078 @kit-ty-kate]
* Add a benchmark for `opam install --check` [#6123 @kit-ty-kate]

## Reftests
### Tests
Expand Down
23 changes: 23 additions & 0 deletions tests/bench/bench.ml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ let () =
in
List.fold_left (+.) 0.0 l /. float_of_int n
in
let time_install_check_installed =
Gc.compact ();
launch (fmt "%s switch create four --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 --check core.v0.15.0" bin)
in
let time_install_check_not_installed =
Gc.compact ();
launch (fmt "%s switch create five --fake ocaml-base-compiler.4.14.0" bin);
time_cmd ~exit:1 (fmt "%s install --check core.v0.15.0" bin)
in
let json = fmt {|{
"results": [
{
Expand Down Expand Up @@ -117,6 +128,16 @@ let () =
"name": "OpamPackage.Version.compare amortised over 100 runs",
"value": %f,
"units": "secs"
},
{
"name": "opam install --check on an already installed package",
"value": %f,
"units": "secs"
},
{
"name": "opam install --check on a non-installed package",
"value": %f,
"units": "secs"
}
]
},
Expand All @@ -138,6 +159,8 @@ let () =
time_OpamSystem_read_100
time_deps_only_installed_pkg
time_OpamPackage_Version_compare_100
time_install_check_installed
time_install_check_not_installed
bin_size
in
print_endline json

0 comments on commit 6b65594

Please sign in to comment.