Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmarks for opam show #6212

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ users)
## Test

## Benchmarks
* Add benchmarks for `opam show` [#6212 @kit-ty-kate]

## Reftests
### Tests
Expand Down
42 changes: 42 additions & 0 deletions tests/bench/bench.ml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,24 @@ let () =
launch (fmt "%s switch create six --empty" bin);
time_cmd ~exit:0 (fmt "%s list --installed --short --safe --color=never ocp-indent ocp-index merlin" bin)
in
launch (fmt "%s switch create seven --empty" bin);
launch (fmt "%s install -y --fake dune" bin);
let time_show_installed =
Gc.compact ();
time_cmd ~exit:0 (fmt "%s show dune" bin)
in
let time_show_with_depexts =
Gc.compact ();
time_cmd ~exit:0 (fmt "%s show conf-pkg-config" bin)
in
let time_show_raw =
Gc.compact ();
time_cmd ~exit:0 (fmt "%s show --raw conf-pkg-config" bin)
in
let time_show_precise =
Gc.compact ();
time_cmd ~exit:0 (fmt "%s show --raw conf-pkg-config.2" bin)
in
let json = fmt {|{
"results": [
{
Expand Down Expand Up @@ -148,6 +166,26 @@ let () =
"name": "opam list --installed on non-installed packages",
"value": %f,
"units": "secs"
},
{
"name": "opam show of an installed package",
"value": %f,
"units": "secs"
},
{
"name": "opam show with depexts",
"value": %f,
"units": "secs"
},
{
"name": "opam show --raw pkgname",
"value": %f,
"units": "secs"
},
{
"name": "opam show --raw pkgname.version",
"value": %f,
"units": "secs"
}
]
},
Expand All @@ -172,6 +210,10 @@ let () =
time_install_check_installed
time_install_check_not_installed
time_list_installed_noninstalled_packages
time_show_installed
time_show_with_depexts
time_show_raw
time_show_precise
bin_size
in
print_endline json
Loading