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

Improve performance of some opam list combination #4999

Merged
merged 4 commits into from
Jan 18, 2022
Merged
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
4 changes: 3 additions & 1 deletion master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ users)
* ◈ New option `opam pin --current` to fix a package in its current state (avoiding pending reinstallations or removals from the repository) [#4973 @AltGr - fix #4970]

## List
* Some optimisations to 'opam list --installable' queries combined with other filters [@altgr]
* Some optimisations to 'opam list --installable' queries combined with other filters [#4882 @altgr - fix #4311]
* Improve performance of some opam list combination (e.g. --available --installable) [#4999 @kit-ty-kate]
* Improve performance of opam list --conflicts-with when combined with other filters [#4999 @kit-ty-kate]

## Show
* Add `depexts` to default printer [#4898 @rjbou]
Expand Down
6 changes: 3 additions & 3 deletions src/client/opamListCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ let apply_selector ~base st = function
base
| Conflicts_with packages ->
OpamSwitchState.conflicts_with st (OpamPackage.Set.of_list packages)
(Lazy.force st.available_packages)
base
| Coinstallable_with (tog, packages) ->
let universe = get_universe st tog in
let set = OpamPackage.Set.of_list packages in
Expand Down Expand Up @@ -370,11 +370,11 @@ let apply_selector ~base st = function

let rec filter ~base st = function
| Empty -> base
| Atom select -> apply_selector ~base st select
| Atom select -> base %% apply_selector ~base st select
kit-ty-kate marked this conversation as resolved.
Show resolved Hide resolved
| Block b -> filter ~base st b
| And (a, b) ->
let base = filter ~base st a in
base %% filter ~base st b
filter ~base st b
| Or (a, b) -> filter ~base st a ++ filter ~base st b

type output_format =
Expand Down