From a14a308fbe00664904c3032df1139c71bbc0505e Mon Sep 17 00:00:00 2001 From: Mao Zeng Date: Thu, 29 Aug 2024 23:29:22 +0100 Subject: [PATCH] Efficiency improvement in fullac matching: don't bother permute arguments if the head doesn't match. --- src/matchers.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/matchers.jl b/src/matchers.jl index f5ba090ac..5de643abb 100644 --- a/src/matchers.jl +++ b/src/matchers.jl @@ -117,6 +117,9 @@ function term_matcher(term, fullac_flag = false) data_arg_perms = permutations(args) result = nothing T = symtype(data) + if op != operation(term) + return nothing + end for perm in data_arg_perms data_permuted = Term{T}(op, perm) result = loop(data_permuted, bindings, matchers) # Try to eat exactly one term