From f48a698458300d0266f901fbbf2008c936618c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Thu, 23 Mar 2023 17:58:49 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Suboptimal=20temporary=20terms?= =?UTF-8?q?=20for=20external=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a given external function was called two times with different arguments, then the second call would always be computed in the same temporary terms chunk (derivation order or block) as the first call, even if this was not necessary (technically, the second call would be promoted in the temporary terms computation in the same category as the first call). This could possibly lead to an inefficiency. --- src/ExprNode.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ExprNode.cc b/src/ExprNode.cc index dc166264..98ac170a 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -7570,7 +7570,7 @@ ExternalFunctionNode::sameTefTermPredicate() const { return [this](expr_t e) { auto e2 = dynamic_cast(e); - return (e2 != nullptr && e2->symb_id == symb_id); + return (e2 != nullptr && e2->symb_id == symb_id && e2->arguments == arguments); }; } @@ -7900,12 +7900,12 @@ FirstDerivExternalFunctionNode::sameTefTermPredicate() const if (first_deriv_symb_id == symb_id) return [this](expr_t e) { auto e2 = dynamic_cast(e); - return (e2 && e2->symb_id == symb_id); + return (e2 && e2->symb_id == symb_id && e2->arguments == arguments); }; else return [this](expr_t e) { auto e2 = dynamic_cast(e); - return (e2 && e2->symb_id == symb_id); + return (e2 && e2->symb_id == symb_id && e2->arguments == arguments); }; } @@ -8244,12 +8244,12 @@ SecondDerivExternalFunctionNode::sameTefTermPredicate() const if (second_deriv_symb_id == symb_id) return [this](expr_t e) { auto e2 = dynamic_cast(e); - return (e2 && e2->symb_id == symb_id); + return (e2 && e2->symb_id == symb_id && e2->arguments == arguments); }; else return [this](expr_t e) { auto e2 = dynamic_cast(e); - return (e2 && e2->symb_id == symb_id); + return (e2 && e2->symb_id == symb_id && e2->arguments == arguments); }; }