Skip to content

Commit

Permalink
Merge pull request ocaml#4999 from kit-ty-kate/perf-improvement-list
Browse files Browse the repository at this point in the history
Improve performance of some opam list combination
  • Loading branch information
kit-ty-kate authored and rjbou committed Apr 27, 2022
1 parent 38e98b4 commit ad9547a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ New option/command/subcommand are prefixed with ◈.
* Improve performance of opam list --conflicts-with when combined with other filters [#4999 @kit-ty-kate]
* Fix coinstallability filter corner case [#5024 @AltGr]
* 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
*
Expand Down
6 changes: 3 additions & 3 deletions src/client/opamListCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,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 @@ -371,11 +371,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
| 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

0 comments on commit ad9547a

Please sign in to comment.