[m-rev.] for post-commit review: fix a perf regression for --generate-dependencies

Julien Fischer jfischer at opturion.com
Thu Aug 14 10:57:23 AEST 2025


On Thu, 14 Aug 2025 at 07:24, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:

> Mostly fix a perf regression in --generate-dependencies.

...

> library/digraph.m:
>     Add the specialized reachability-only predicate.
>
> NEWS.md:
>     Announce the new predicate in digraph.m.
>

...

> diff --git a/library/digraph.m b/library/digraph.m
> index 30f4d63bf..3fff951b2 100644
> --- a/library/digraph.m
> +++ b/library/digraph.m
> @@ -266,6 +266,17 @@
>      digraph_key_set(T)::in, digraph_key_set(T)::out,
>      list(digraph_key(T))::out) is det.
>
> +%---------------------------------------------------------------------------%
> +%
> +% Reachability.
> +%
> +
> +    % reachable_vertices_from(G, FromVertex, ReachableVertices):
> +    %
> +    % Return the set of vertices that are reachable from FromVertex in G.

This comment should say whether the set returned includes FromVertex or not.

> +    %
> +:- pred reachable_vertices_from(digraph(T)::in, T::in, set(T)::out) is det.

Some alternative suggestions for names: reachable_vertex_set or
reachable_vertices.

Julien.


More information about the reviews mailing list