[m-rev.] for review: speed up find_edit_distance
Julien Fischer
jfischer at opturion.com
Thu Jan 25 21:52:51 AEDT 2024
On Thu, 25 Jan 2024, Zoltan Somogyi wrote:
> Speed up find_edit_distance.
>
> library/edit_distance.m:
> Speed up the find_edit_distance predicate by
>
> - changing it to operate on arrays instead of maps, and
> - reusing the *same* three arrays over and over.
>
> diff --git a/library/edit_distance.m b/library/edit_distance.m
> index c54bae746..3c6bfc110 100644
> --- a/library/edit_distance.m
> +++ b/library/edit_distance.m
...
> @@ -166,77 +169,112 @@ find_edit_distance(Params, SeqA, SeqB, Cost) :-
> % RowNum here iterates from 0u up to LenB - 1u.
> % And just as in the gcc code j iterates from 0 up to len_s-1,
> % J here iterates from 0u up to LenA - 1u.
> - map.init(RowTwoAgo),
> - init_row_zero(DeleteCost, 0u, LenA, map.init, RowOneAgo),
> + %
> + % The Mercury compiler uses this predicate mostly when constructing
> + % "did you mean" addendums for diagnostic messages reporting
> + % failed name lookups. In modules that are large themselves, or
> + % (more likely) in modules that import many other modules, the set of
> + % names to which we want to compare the name whose lookup failed
> + % can be quite large. In such sitations, the code constructing
s/sitations/situations/
That looks fine otherwise.
Julien.
More information about the reviews
mailing list