From 60e0bf5f42668e9a28f9bc8e04b30120ddbfc234 Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 16 Jan 2022 14:04:58 +0000 Subject: [PATCH 1/4] Improve performance of some opam list combination (e.g. --available --installable) --- src/client/opamListCommand.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/opamListCommand.ml b/src/client/opamListCommand.ml index d345afb30ea..c2284545ae5 100644 --- a/src/client/opamListCommand.ml +++ b/src/client/opamListCommand.ml @@ -370,12 +370,12 @@ 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 - | Or (a, b) -> filter ~base st a ++ filter ~base st b + | Or (a, b) -> base %% (filter ~base st a ++ filter ~base st b) type output_format = | Name From d2e661b22d3c236595660ca3ca4805e2367baa95 Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 16 Jan 2022 14:12:21 +0000 Subject: [PATCH 2/4] Improve performance of opam list --conflicts-with when combined with other filters --- src/client/opamListCommand.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/opamListCommand.ml b/src/client/opamListCommand.ml index c2284545ae5..adab696953e 100644 --- a/src/client/opamListCommand.ml +++ b/src/client/opamListCommand.ml @@ -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 From 64ee3d4c710b67da9f785c90461a5c2a5c6e30ff Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 16 Jan 2022 14:21:35 +0000 Subject: [PATCH 3/4] Update master_changes.md --- master_changes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/master_changes.md b/master_changes.md index a1f0c508c37..c5a3919e4c1 100644 --- a/master_changes.md +++ b/master_changes.md @@ -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] From c4ca74df9eed2b51d4ce22f3052c4f22befacd1f Mon Sep 17 00:00:00 2001 From: Kate Date: Mon, 17 Jan 2022 16:16:18 +0000 Subject: [PATCH 4/4] Simplify OpamListCommand.filter Co-authored-by: Louis Gesbert --- src/client/opamListCommand.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/opamListCommand.ml b/src/client/opamListCommand.ml index adab696953e..d491d2bb585 100644 --- a/src/client/opamListCommand.ml +++ b/src/client/opamListCommand.ml @@ -374,8 +374,8 @@ let rec filter ~base st = function | Block b -> filter ~base st b | And (a, b) -> let base = filter ~base st a in - base %% filter ~base st b - | Or (a, b) -> base %% (filter ~base st a ++ filter ~base st b) + filter ~base st b + | Or (a, b) -> filter ~base st a ++ filter ~base st b type output_format = | Name