Skip to content

Commit

Permalink
Add benchmarks for opam show
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Sep 25, 2024
1 parent b812814 commit 709388a
Show file tree
Hide file tree
Showing 2 changed files with 43 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 @@ -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 --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

0 comments on commit 709388a

Please sign in to comment.