From 2f1514c58517e2f38acfe337175f843f156530cf Mon Sep 17 00:00:00 2001 From: Max Willsey Date: Tue, 16 Apr 2024 08:24:14 -0700 Subject: [PATCH] Fix matching perf regression Introduced in ae8af8815231e4aba1b78962f8c07ce837ee1c0e, this bug caused the default impl of search for patterns to bypass the discriminator index. --- CHANGELOG.md | 2 +- src/rewrite.rs | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17cc08fe..bf19bfb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [Unreleased] - ReleaseDate - Change the API of `make` to have mutable access to the e-graph for some [advanced uses cases](https://github.com/egraphs-good/egg/pull/277). - +- Fix an e-matching performance regression introduced in [this commit](https://github.com/egraphs-good/egg/commit/ae8af8815231e4aba1b78962f8c07ce837ee1c0e#diff-1d06da761111802c793c6e5ca704bfa0d6336d0becf87fddff02d81548a838ab). ## [0.9.5] - 2023-06-29 - Fixed a few edge cases in proof size optimization that caused egg to crash. diff --git a/src/rewrite.rs b/src/rewrite.rs index 6b34b48b..1a3ea5f4 100644 --- a/src/rewrite.rs +++ b/src/rewrite.rs @@ -186,14 +186,9 @@ where /// Search the whole [`EGraph`], returning a list of all the /// [`SearchMatches`] where something was found. - /// This just calls [`search_eclass`] on each eclass. - /// - /// [`search_eclass`]: Searcher::search_eclass + /// This just calls [`Searcher::search_with_limit`] with a big limit. fn search(&self, egraph: &EGraph) -> Vec> { - egraph - .classes() - .filter_map(|e| self.search_eclass(egraph, e.id)) - .collect() + self.search_with_limit(egraph, usize::MAX) } /// Similar to [`search`], but return at most `limit` many matches.